User Tools

Site Tools


mysql_maxconnections

You are able to view the max connections for mysql with the following command:

mysql -e 'show variables;' | grep max_connections
OR if you log into mysql you can use the following command:
show variables like 'max_connections';
You should have a similar output:
max_connections 151

There are two options to set the max connections for mysql, you can edit the setting in mysql (which is not permanent) and you can edit the variable in the /etc/my.cnf file which will be permenant (when service is restarted the variable is still in place).

Option 1

You can use the following command from your shell (you do not need to log directly into mysql for this if your /etc/my.cnf file has been configured).

mysql -e 'set global max_connections = 200;'
If you now grep for max connections it should show 200.
mysql -e 'show variables;' | grep max_connections

Option 2

Edit the /etc/my.cnf file with the new variable settings for them to be permanent. Add the following code to the file:

[mysqld]
max_connections = 1000



Setting max user connections

mysql -e 'show variables;' | grep -i max_user_connections

show variables like 'max_user_connections';

mysql_maxconnections.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1