Home >Database >Mysql Tutorial >A brief analysis of two methods for setting the maximum number of connections in mysql

A brief analysis of two methods for setting the maximum number of connections in mysql

青灯夜游
青灯夜游forward
2022-07-12 11:03:042931browse

How to set the maximum number of connections in mysql? The following article will introduce to you two methods for setting the maximum number of connections in MySQL. I hope it will be helpful to you.

A brief analysis of two methods for setting the maximum number of connections in mysql

Usually, the default maximum number of connections for mysql is 100, and the maximum number can reach 16384; if we want to modify the maximum number of connections for mysql, how to set it? Take a look below.

Method 1: Command line modification

We only need to open the mysql console and enter the "set GLOBAL max_connections=1000;" statement to directly set the maximum connection Number, as shown in the figure below:

Note: This method does not cure the problem. It can only temporarily modify the maximum number of connections. If you restart mysql, the maximum number of connections will change again. Return to the originally set value.

Method 2: Modify the maximum number of connections through the mysql configuration file

1. Open the mysql installation directory on the computer and find the my.ini file, as shown below Shown:

2. Open the my.ini file with Notepad, find and modify the value of "max_connections", the default maximum number of connections It is 100, as shown in the figure below:

Set "max_connections=1000", so that the maximum number of mysql connections can be set to 1000.

3. After setting the maximum number of connections, you need to restart the mysql service

Go to [Computer]-->[Management]-->[Services and Applications] Program]-->[Service]-->[MySQL]

Click mysql and right-click to start or shut down, as shown in the following figure:

This sets the maximum number of mysql connections to 1000, and it is a permanent setting.

[Related recommendations: mysql video tutorial]

The above is the detailed content of A brief analysis of two methods for setting the maximum number of connections in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete