Home > Database > Mysql Tutorial > body text

How to check the number of connections and connection status in MySQL

小云云
Release: 2017-11-27 10:10:25
Original
8008 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template