Increasing MySQL Connection Limits
MySQL has a default maximum connection limit of approximately 100, which may not be sufficient for high-traffic applications. This article explores methods to increase the number of MySQL connections past this limit.
Dynamic Connection Limit Adjustment
Without restarting MySQL, connections can be increased using the following command:
mysql> SET GLOBAL max_connections = 150;
This changes the max_connections limit to 150, but only applies until the MySQL service is restarted.
Permanent Connection Limit Changes
To permanently increase the connection limit, a modification to the MySQL configuration file (my.cnf) is required. First, locate the "mysqld" section and insert the following line:
max_connections = 150
Restart MySQL to apply the change.
Checking the New Limit
To verify the new connection limit, use the following command:
mysql> show variables like 'max_connections';
The output should display the updated value.
The above is the detailed content of How to Increase MySQL Connection Limits?. For more information, please follow other related articles on the PHP Chinese website!