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
1 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.
-
To make the ``` max_connections ``` parameter change permanent, we need to restart the service, right? Jun 22, 2020 at 12:29
-
1@PradeepSanjeewa Right. Placed in
my.cnf
this value becomes permanent, but you do not need to restart the serveice immediately. You can set it dynamically for immediate use and change it in themy.cnf
where it will postponed until restart.– KondybasJun 22, 2020 at 12:42 -
1