≡ Menu

How to find MySQL queries per second on my Linux box?

The question – I want to find out what load my MySQL database runs under. So if I could get the queries per second that the MySQL database serves, that would be great. Is there a mysqld directive or command that can get queries per second?

There is a mysqladmin command that can give you a lot of interesting statistics about your MySQL server database operations.

On your SSH shell or local terminal type the following command:

mysqladmin status

This output of the command (newlines added for better readability) is as follows:

root@server [/etc]# mysqladmin status
Uptime: 12940  
Threads: 13  
Questions: 1144631  
Slow queries: 1  
Opens: 446  
Flush tables: 1  
Open tables: 256  
Queries per second avg: 88.456
root@server [/etc]#

This shows that MySQL is serving about 88 queries per second. This is a very high load! But I have a dedicated server with lots of RAM so this is not a problem!

The command also shows the uptime (time in seconds since last restart), the number of threads, the number of queries since the last restart, number of slow queries and other statistics about the database server.

Note that if you do not have root access, you must supply your database user name and password:

mysqladmin -u databaseuser -p status

For more information about the command mysqladmin, refer to it’s man page:

man mysqladmin

{ 0 comments… add one }

Leave a Comment