MySQL
MySQL how To – show open database connections
May 15, 2016
0

MySQL Current Connection Query Information

You can show MySQL open database connections (and other MySQL database parameters) using the MySQL show status command, like this:

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)


Notice that I use like 'Conn%'in the first example to show variables that look like “Connection”, then got a little wiser in my second MySQL show status query.

MySQL show processlist

Here’s what my MySQL processlist:

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)

MySQL Status

Using the mysqladmin command at the Unix/Linux command line, like this:

$ mysqladmin status

Uptime: 4661  Threads: 1  Questions: 200  Slow queries: 0  Opens: 16  Flush
tables: 1  Open tables: 6  Queries per second avg: 0.043

About author

ZERIN

CEO & Founder (BdBooking.com - Online Hotel Booking System), CEO & Founder (TaskGum.com - Task Managment Software), CEO & Founder (InnKeyPro.com - Hotel ERP), Software Engineer & Solution Architect

Upgrading MySQL 5.6 to 5.7 – Group By Does not work anymore

Recently I have updated one of my server MySQL, th...

Read more

Linux How to Find Files based on the File Size

If you want to search all the files that are more ...

Read more

MySQL: ERROR 1129 (HY000) Host 'Crowder' is blocked because of many connection errors

If you get the Host ‘host_name’ is blo...

Read more

There are 0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *