mysql批量kill语句

mysql服务器负载太大,卡死

mysql> SELECT concat('KILL ',id,';') FROM information_schema.processlist WHERE user='root';
+------------------------+
| concat('KILL ',id,';') 
+------------------------+
| KILL 3101;             
| KILL 2946;             
+------------------------+
2 rows IN SET (0.00 sec)
 
mysql> SELECT concat('KILL ',id,';') FROM information_schema.processlist WHERE user='root' INTO OUTFILE '/tmp/kill.txt';
Query OK, 2 rows affected (0.00 sec)
 
mysql> source /tmp/kill.txt;
Query OK, 0 rows affected (0.00 sec)

 

posted @ 2023-02-06 19:51  chenjianwen  阅读(317)  评论(0编辑  收藏  举报