Home >Database >Mysql Tutorial >How to Increase the Maximum Number of MySQL Connections?

How to Increase the Maximum Number of MySQL Connections?

Patricia Arquette
Patricia ArquetteOriginal
2024-11-04 14:19:01272browse

How to Increase the Maximum Number of MySQL Connections?

Customizing MySQL Connection Limits

By default, MySQL databases have a maximum connection limit of 100. However, it may be necessary to increase this limit for high-traffic applications.

To increase the maximum number of connections without restarting MySQL, execute the following SQL statement:

<code class="sql">SET GLOBAL max_connections = <desired_value>;</code>

For example, to increase the limit to 150:

<code class="sql">SET GLOBAL max_connections = 150;</code>

These changes are temporary and will be reset upon MySQL restart.

For permanent changes, modify the my.cnf configuration file by adding the following line:

<code class="conf">max_connections = <desired_value></code>

Followed by restarting MySQL.

The above is the detailed content of How to Increase the Maximum Number of MySQL Connections?. 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