Question :
I need to change max_connections
parameter in /etc/my.cnf
. After doing the change, do we need to restart mysqld service to apply the changes?
I’m on CentOS 7
Answer :
Some server parameters are dynamic and can be changed on the fly. Some are not and should be configured in the my.cnf
followed by service restart. max_connections
can be changed on the fly by command SET GLOBAL max_connections=XXX
. This value will be in effect until service restart.
To be clear, the possible options are:
- Run
SET GLOBAL max_connections = XXX
for immediate use until service restarted - Add the
max_connections = XXX
line to the[mysqld]
section of themy.cnf
AND restart the service for permanent use - Run
SET GLOBAL max_connections = XXX
AND add themax_connections = XXX
line to themy.cnf
but DO NOT restart the service.
The third option allows to get both immediate changes as well as permanent but with zero downtime. Value in the my.cnf
will wait for some event/incident/accident causing a service’s restart.