Mysql系列【解决mysql连接数太多】

1.问题

mysql连接数太多

2.解决方案

service mysql stop
vi /etc/my.cnf
max_connections=1000        #最大连接数
max_user_connections=500    #设置单个用户最大连接数限制
wait_timeout=200            #最大存活时间(单位:秒),默认8小时

select `USER`,COUNT(`USER`) AS CNT from information_schema.PROCESSLIST GROUP BY `USER` ORDER BY CNT DESC;
一个参考数值,将 max_user_connections 设置为正常情况下单用户最大连接数的3-5倍。

 3.重启

service mysql start 
原文地址:https://www.cnblogs.com/hujunwei/p/15587494.html