MySQL is a relational database management system that stores data in different tables instead of putting all data in one big warehouse, which increases speed and flexibility. The SQL language used by MySQL is the most commonly used standardized language for accessing databases. In this article, we will share with you a little knowledge about how to check the number of connections and connection status in MySQL.
1. mysql> show status like & 39;%connect%& 39;;Connections, the number of connections trying to connect to the MySQL server (whether successful or not). Max_used_connections
1, mysql> show status like '%connect%';
Connections, the number of connections trying to connect to the MySQL server (whether successful or not).
Max_used_connections, the maximum number of connections that have been used simultaneously after the server is started.
Threads_connected, the current number of connections.
2. mysql> show variables like '%connect%';
max_connections, the maximum number of connections.
3. Modify max_connections
In the configuration file (my.cnf or my.ini) at the bottom, add a sentence:
max_connections=32000
Then, restart with the command: /etc/init.d/mysqld restart
Although 32000 is written here, the actual maximum number of connections allowed by the MySQL server is 16384;
Added the maximum number of connections allowed , little increase in system consumption.
4. mysql> show processlist;
Display the MySQL connection currently executing.
The above is a small method on how to check the number and status of connections in MySql. I hope it will be useful to everyone.
Related recommendations:
MySql status viewing method How to check the number and status of MySql connections?
PHP Universal Connection Database Method
Linux Tutorial: Querying the Number of Concurrent Connections and Connection Status of Nginx
The above is the detailed content of How to check the number of connections and connection status in MySQL. For more information, please follow other related articles on the PHP Chinese website!