Check The Number Of MySQL Open Database Connections on Linux Or Unix-like Server

Check The Number Of MySQL Open Database Connections on Linux Or Unix-like Server

To check the number of open database connections in MySQL on a Linux or Unix-like server, you can use the following steps:

  1. Connect to the MySQL server using the mysql command:
r‮refe‬ to:lautturi.com
mysql -u username -p

Replace username with the username of the MySQL account you want to use to connect. You will be prompted for the password for the account.

  1. Once connected to the MySQL server, run the following command to check the number of open database connections:
SHOW STATUS WHERE `variable_name` = 'Threads_connected';

This will output a line similar to the following:

+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_connected | 2     |
+-------------------+-------+

The Value column shows the number of open database connections.

  1. To check the maximum number of connections that the MySQL server is configured to allow, you can run the following command:
SHOW VARIABLES WHERE `variable_name` = 'max_connections';

This will output a line similar to the following:

+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 150   |
+-----------------+-------+

The Value column shows the maximum number of connections that the MySQL server is configured to allow.

Created Time:2017-10-28 14:02:22  Author:lautturi