慢慢赚钱博客

7月 24 2019

centos7下mariadb不能增加连接数max_connections不生效

centos7下mariadb不能增加连接数max_connections不生效
centos7

MySQL values open_files_limit and max_connections are not applied
你虽然在配置文件已经加了:
grep -i 'max_connections' /etc/my.cnf
max_connections=2048
但是不生效:
plesk db "SHOW GLOBAL VARIABLES LIKE 'max_connections' \G"
*************************** 1. row ***************************
Variable_name: max_connections
Value: 214
查看报错:
The value of open_files_limit is reset after system updates are installed.
In the log file /var/log/mysqld.log the following records can be found:
[Warning] Changed limits: max_open_files: 1024 max_connections: 214 table_cache: 400
解决办法:
Create an override for the service file from the previous step:
systemctl edit mariadb.service
添加:
[Service]
LimitNOFILE=4096
重启:
systectl restart mariadb.service

Written by moneyslow.com

moneyslow.com真棒!