Menu Close

View Live current mysql queries

For see from command line current execution of queries you can use:

$ mysqladmin -u bob -p -i 1 processlist

This will print the current queries on your screen every second.

  • -u The mysql user you want to execute the command as
  • -p Prompt for your password (so you don’t have to save it in a file or have the command appear in your command history)
  • i The interval in seconds.

If you want to see output like “SHOW FULL PROCESSLIST” you can attach “–verbose” to the command.

Take a look at http://dev.mysql.com/doc/refman/5.6/en/mysqladmin.html for more useful command to use with mysqladmin tool like:

$ mysqladmin -u bob -p -i 1 proc stat --verbose

that return something like:

+----+-------+-----------+----+---------+------+-------+-----------------------+
| Id | User  | Host      | db | Command | Time | State | Info                  |
+----+-------+-----------+----+---------+------+-------+-----------------------+
| 51 | monty | localhost |    | Query   | 0    |       | show full processlist |
+----+-------+-----------+----+---------+------+-------+-----------------------+
Uptime: 1473624  Threads: 1  Questions: 39487
Slow queries: 0  Opens: 541  Flush tables: 1
Open tables: 19  Queries per second avg: 0.0268
Posted in Linux, News, Web Development

Leave a Reply

Your e-mail address will not be published. Required fields are marked *