x
Loading
 Loading
Hello, Guest | Login | Register

Peering Under the Hood, Part One

On a busy server, it’s often hard to keep track of what’s running and when, so from time to time, you may find yourself wondering what MySQL is doing. Luckily, MySQL provides a degree of transparency that makes it relatively easy to peer inside and see what’s up.

On a busy server, it’s often hard to keep track of what’s running and when, so from time to time, you may find yourself wondering what MySQL is doing. Luckily, MySQL provides a degree of transparency that makes it relatively easy to peer inside and see what’s up.

Who and What

One of the most basic questions that you’re likely to ask is, “Who’s connected to MySQL and what are they doing?” Now, you could fall back on classic Unix tools such as netstat to figure out which clients have connections open to TCP port 3306, but that would tell you only which machines are connected — not necessarily who is connected. The best way to track down who’s connected to MySQL is to use MySQL’s own SHOW PROCESSLIST command. Like most of MySQL’s SHOW commands, it produces easy to read tabular output, as shown in Figure One.

Figure One

 +——–+——————+———————-+————+————————–+ | Id | User | Host | db | Command | Time | State | Info | +——–+——————+———————-+————+————————–+ | 17 | jzawodn | localhost | NULL | Query | 0 | NULL | show | 

In Figure One, you’ll see one “record” for each connected user, detailing who the user is, what they’re doing, and so on. Here’s what the columns mean:

* ID. This is the “thread id” for the given…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Got Security? You're in Denial
  2. KDE 4.4: Does It Work Yet?
  3. Writing Custom Nagios Plugins with Python
  4. Power Up Linux GUI Apps
  5. Tweeting from the Command Line with Twyt
Follow Linux Magazine
Rackspace