批量KILL MYSQL数据库进程
henry.huang

1. 查询进程

1
2
3
4
5
6
7
SELECT
*
FROM
information_schema.`PROCESSLIST`
WHERE
info IS NOT NULL
ORDER BY TIME DESC;

2. kill单个进程

1
kill id;

3. 批量kill

3.1 拼接kill命令

1
2
3
4
5
6
7
select 
concat('KILL ',id,';')
from
information_schema.processlist
where
user='user_nasme'
and info is not null ;

3.2 复制查询结果并执行

 评论