Home > Database > Mysql Tutorial > body text

What should I do if mysql database prompts that there are too many connections?

王林
Release: 2020-10-15 11:25:43
Original
7382 people have browsed it

Solution to the problem that mysql database prompts that there are too many connections: 1. Log in to the mysql database and view the currently active connection thread variable values; 2. Edit the my.cnf configuration file and add [[mysqld] port=3306]; 3. Restart the mysql server.

What should I do if mysql database prompts that there are too many connections?

Solution:

View max_connections

(Recommended tutorial: mysql video tutorial)

Enter MySQL, use the command:

$ show variables
Copy after login

View the variable value of the maximum number of connections to the database: max_connections

View threads_connected

Enter MySQL, use the command:

$ show status
Copy after login

View the currently active connection thread variable value: threads_connected

Set max_connections, in the my.cnf file, add the following last line:

Copy

[mysqld] port=3306    #socket=MySQL ...set-variable = max_connections=32000
Copy after login

After the modification is completed, restart MySQL. Of course, to make sure the settings are correct, you should look at max_connections.

Note:

1. Although 32000 is written here. However, the actual maximum number of connections allowed by the MySQL server is 16384;

2. In addition to max_connections, the other configurations mentioned above should be configured according to the needs of your system without being rigid;

3. The maximum allowed number is added The number of connections does not increase system consumption much.

4. If your mysql uses my.ini as the configuration file, the settings are similar, but the format should be slightly modified

Related recommendations: mysql tutorial

The above is the detailed content of What should I do if mysql database prompts that there are too many connections?. 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 [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!