mysql too many connections 解决方法(亲测有效)

1.找到mysql的配置文件 mysql.cnf , 我的路径是 /etc/mysql/mysql.conf.d/mysqld.cnf

2 编辑配置文件 找到 max_connections(最大连接数) 并更改数值,添加 wait_timeout(超时时间)

vim /etc/mysql/mysql.conf.d/mysqld.cnf

在这里插入图片描述
3. 然后在重启服务即可

service mysql restart 

以下方法 服务重启失效 需要重新设置

查看最大连接数

show variables like '%max_connections%';  

设置最大连接数

set GLOBAL max_connections=300; 

查看超时间

show global variables like 'wait_timeout'; 

设置超时时间

set global wait_timeout=30; 

查看连接数

show processlist;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值