X

Increasing MySQL Max Connections

MySQL Tutorials

You can see what the current setting is by running the following SQL command from the MySQL command line tool, phpMyAdmin, or a similar tool:

show variables like "max_connections";

This will return a resultset like this, showing you what your current max connections setting is:

MariaDB [(none)]> show variables like "max_connections";
 +-----------------+-------+
 | Variable_name | Value |
 +-----------------+-------+
 | max_connections | 151 |
 +-----------------+-------+
 1 row in set (0.01 sec)

You can change the setting to e.g. 1200 by issuing the following command without having to restart the MySQL server (obviously it will only work if the user you are logged in as has sufficient permissions to do this):

MariaDB [(none)]> set global max_connections = 1200;
 Query OK, 0 rows affected (0.01 sec)

To make this change permanent, you will need to update the mysql conf (/etc/my.cnf) and insert the following line under [mysqld]

max_connections = 1200

That is all you need to do to increase or decrease max mysql connections without restarting mysql.

LinuxAdmin.io
0 0 votes
Article Rating
LinuxAdmin.io:
Related Post