MySQL提示:too many connections

1.首先查询最大连接数

show variables like '%max_connections%';

2.检查当前的连接情况:

show processlist;

3.批量kill当前的连接:

通过information_schema.processlist表中的连接信息生成需要处理掉的MySQL连接的语句临时文件,然后执行临时文件中生成的指令

获取当前连接的id:

select concat('KILL ',id,';') from information_schema.processlist where user='yxyq';

转存到文件中:

select concat('KILL ',id,';') from information_schema.processlist where user='yxyq' into outfile 'D:/BCSoftware/mysql-8.0.13-winx64/a.txt';

执行文件:

source D:/BCSoftware/mysql-8.0.13-winx64/a.txt;

其他kill方式:https://www.cnblogs.com/liang545621/p/9401113.html

原文地址:https://www.cnblogs.com/minutes/p/11088638.html