How do I know which MySQL server handles queries at the moment?

You never like to unat′ ever: “what the hell does MySQL Server?!”
Or where does the load on it?

The answer to the question is utillita MyTop.

On CentOS is with the command:
# yum-y install mytop

This is a clone of a top, utility, which is familiar to every system administrator, but it is not for the system and for MySQL threads. In a nutshell, this is a great command line utility that connects to the MySQL server, SHOW PROCESSLIST command periodically, SHOW STATUS and displays the summary results to which you can apply different filters. After installation you can run mytop with some parameters, for example,

# mytop-u user-p password-d database

Parameters can be written to the configuration file ~/.mytop.


As seen on screen, the main screen is divided into two parts. Above is statistics for the server (hidden by pressing (H)). There are:
-the host name, version and uptime of MySQL Server;
-the total number of queries processed, and the average number of requests per second;
-the number of cases handled slowly (slow queries);
-current information on the RPS;
-slowly processed requests and threads;
-information on the effectiveness of the key buffer (often MySQL finds the keys in the buffer without going to disk);
-the average number of bytes sent and received by the server, and the number of bytes sent at this time.

In the second part of the screen displays all active threads (including one that uses MyTop).
Here you can see:
-user name;
-database and node;
-the current request or status.

As stated in the documentation, it is better to run the program in an xterm, this Terminal is wider than the usual 80 characters, and rows of a table, you can see all threads.

To select specific nodes or databases, press h or d, user filter key u. Filters resets (F).

For more information on the selected thread press f. k destroys the flow.

If you want to use MyTop in a script or Web application is batch-run with the-b. batched MyTop prints table without restrictions on the number of rows, and then exits.

Mytop long is in Debian and Ubuntu.