分类: Mysql/postgreSQL
2016-11-11 10:39:11
mysql> SELECT concat('KILL ',id,';') FROM information_schema.processlist WHERE user='root' INTO OUTFILE '/tmp/kill_id.txt';
Query OK, 2 rows affected (0.00 sec)
查看临时文件的内容
[mysql@node2 ~]$ more /tmp/kill_id.txt
KILL 1;
KILL 4;
批量删除会话
mysql> source /tmp/kill_id.txt;
-- The End --