mysql max connects_mysql max_connections 总是 4190
項目中,由于連接數過多,提示“Too many connections”,需要增加連接數。我在 /etc/my.cnf中修改了
max_connections = 3000
但是, 一直都是顯示的 214
mysql> show variables like "max_connections";
+—————–+——-+
| Variable_name?? | Value |
+—————–+——-+
| max_connections | 214?? |
+—————–+——-+
1 row in set+
修改 /usr/lib/systemd/system/mariadb.service
LimitNOFILE=65535
LimitNPROC=65535
systemctl status mariadb
Warning: mariadb.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
Hint: Some lines were ellipsized, use -l to show in full.
systemctl daemon-reload
systemctl restart mariadb
show variables like ‘%max_connections%’;
extra_max_connections??? 1
max_connections??? 3000??? —恢復和配置一樣
———————————————4190---------------
mysql max_connections 總是??? 4190
Variable_name??? Value
max_connections??? 4190
查mysql open files
show global variables like ‘%open_files_limit%’;
Variable_name??? Value
open_files_limit??? 5000
所以max_connections 不管設多大,都小于5000
-----解決
修改本地openfiles值
到/etc/security/limits.conf這個檔案。
/etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
查看本地open files
ulimit -a |grep open
open files????????????????????? (-n) 555550
查看
grep LimitNOFILE /usr/lib/systemd/system/mysqld.service
LimitNOFILE = 5000
修改
grep LimitNOFILE /usr/lib/systemd/system/mysqld.service
LimitNOFILE = 50000
reload
Warning: mysqld.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
重啟
systemctl restart mysqld
驗證
grep max_connections /etc/my.cnf
max_connections=32000
show VARIABLES like "max_connections"
Variable_name??? Value
max_connections??? 32000
修改值與mysql值一致
總結
以上是生活随笔為你收集整理的mysql max connects_mysql max_connections 总是 4190的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: idea查看项目pid_idea启动时的
- 下一篇: 高德地图区域线显示_护航国庆假期,助力重