mysql_maxconnections
You are able to view the max connections for mysql with the following command:
1 |
mysql -e 'show variables;' | grep max_connections |
1 |
show variables like 'max_connections' ; |
1 |
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).
1 |
mysql -e 'set global max_connections = 200;' |
1 |
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:
1 2 |
[mysqld] max_connections = 1000 |
Setting max user connections
1 |
mysql -e 'show variables;' | grep -i max_user_connections |
1 |
show variables like 'max_user_connections' ; |
mysql_maxconnections.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1