08.21.2019

Mysql max_connections limit at 214

When I configure mysql to increase max_connections of mysql, I face the problem that max_connections was limit at 214

After making several search on google and stackoverflow, found a solution
Because mysql max_connections was limit by open_files_limit
So that you should inscrease it

vim /etc/security/limits.conf


add following lines

mysql soft nofile 4096
mysql hard nofile 4096


Add the following to the end of file into /etc/pam.d/common-session

session required pam_limits.so


Add the following to the end of file into /etc/pam.d/common-session-noninteractive

session required pam_limits.so


Edit mysql configuration file (my.conf or mysql.conf) and add

open_files_limit = 4096
max_connections = 800
table_open_cache = 600


Restart mysq service then check

mysql> SHOW VARIABLES LIKE '%max_connections%';


Hope this help

Leave a comment