Home  >  Article  >  Database  >  How to Increase MySQL Connection Limits?

How to Increase MySQL Connection Limits?

Barbara Streisand
Barbara StreisandOriginal
2024-11-05 15:19:02547browse

How to Increase MySQL Connection Limits?

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!

Statement:
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