Table of Contents
- MySQL Show Status-open database connections
- MySQL Show Processlist
- MySQL Show Status-summary
MySQL "Show status" Faq:can you demonstrate the MySQL show statuscommand to show MySQL variables and Status information, such as the number of open MySQL connections?
I don ' t has a whole lot of time today to give this a detailed discussion, but it's a quick look at some MySQL work tha T I did recently to show MySQL Open database connections.
MySQL Show Status-open database connections
You can show MySQL Open database connections (and other MySQL database parameters) using the MySQL show status
command, like Thi S
Mysql> Show status like ' conn% '; +---------------+-------+| variable_name | Value |+---------------+-------+| Connections | 8 | +---------------+-------+1 row in Set (0.00 sec) mysql> Show status like '%onn% '; +----------- ---------------+-------+| Variable_name | Value |+--------------------------+-------+| Aborted_connects | 0 | | Connections | 8 | | Max_used_connections | 4 | | Ssl_client_connects | 0 | | Ssl_connect_renegotiates | 0 | | Ssl_finished_connects | 0 | | threads_connected | 4 | +--------------------------+-------+7 rows in Set (0.00 sec)
All those rows and values of that is printed out correspond to MySQL variables so you can look at. Notice that I use on the first like ‘Conn%‘
example to show variables the "Connection" and then got a little wiser in my s Econd MySQL Show status query.
MySQL Show Processlist
Here's what my MySQL processlist looks like when I had my Java application actively running under Tomcat:
Mysql> Show processlist;+----+------+-----------------+--------+---------+------+-------+------------------+| Id | User | Host | db | Command | Time | State | Info |+----+------+-----------------+--------+---------+------+-------+------------------+| 3 | Root | localhost | webapp | Query | 0 | NULL | show Processlist | | 5 | Root | localhost:61704 | WebApp | Sleep | 208 | | NULL | | 6 | Root | localhost:61705 | WebApp | Sleep | 208 | | NULL | | 7 | Root | localhost:61706 | WebApp | Sleep | 208 | | NULL | +----+------+-----------------+--------+---------+------+-------+------------------+4 rows in Set (0.00 Sec
And here's what's it looked like after I shut Tomcat down:
Mysql> Show processlist;+----+------+-----------+--------+---------+------+-------+------------------+| Id | User | Host | db | Command | Time | State | Info |+----+------+-----------+--------+---------+------+-------+------------------+| 3 | Root | localhost | WebApp | Query | 0 | NULL | show Processlist | +----+------+-----------+--------+---------+------+-------+------------------+1 row in Set (0.00 sec)
As a final note, you can also look at some MySQL variables using mysqladmin
the command on the command line of the unix/linux, like th is:
$ mysqladmin statusuptime:4661 threads:1 questions:200 Slow queries:0 opens:16 flushtables : 1 Open tables:6 Queries per second avg:0.043
MySQL Show Status-summary
Finally, here is the Quick links to MySQL status pages:
- Server Status variables
- Show Status Command
I Hope this brief look at the MySQL SHOW STATUS command have been helpful. As can see that you can show information about a lot of MySQL status information, including the number of MySQL database C Onnections, MySQL processes, and much more.
MySQL Show Status-show Open database connections