Home > Database > Mysql Tutorial > How to set the maximum number of connections in mysql

How to set the maximum number of connections in mysql

青灯夜游
Release: 2020-10-12 17:42:58
Original
33637 people have browsed it

How to set the maximum number of mysql connections: first open the mysql console; then enter the statement [set GLOBAL max_connections=1000;] to directly set the maximum number of connections.

How to set 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? The following article will take you through two methods of setting the maximum number of mysql connections. I hope it will be helpful to you. [Video tutorial recommendation: MySQL tutorial]

How to set the maximum number of mysql connections:

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 number of connections, as shown in the following figure:

How to set the maximum number of connections in mysql

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 return to the original 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:

How to set the maximum number of connections in mysql

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

How to set the maximum number of connections in mysql

How to set the maximum number of connections in mysql

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]--> [Service]-->[MySQL]

How to set the maximum number of connections in mysql

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

How to set the maximum number of connections in mysql

In this way, the maximum number of mysql connections is set to 1000, and it is a permanent setting.

The above is the entire content of this article, I hope it will be helpful to everyone's study. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of How to set the maximum number of connections in mysql. For more information, please follow other related articles on the PHP Chinese website!

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