Question : bulk kill mysql processlist
Answered by : shiny-skipper-0ly8ixd0n3ha
SELECT CONCAT('KILL ',id,';') AS IDs
FROM information_schema.processlist
WHERE TIME >10
AND command = "sleep"
Source : https://stackoverflow.com/questions/44192418/how-to-find-mysql-process-list-and-to-kill-those-processes/44192419 | Last Update : Mon, 21 Dec 20
Question : mysql kill
Answered by : lucky-ladybird-35159pg8w8k2
mysql> SELECT GROUP_CONCAT(CONCAT('KILL ',id,';') SEPARATOR ' ')
FROM information_schema.processlist WHERE user <> 'system user';
Source : https://scaledynamix.com/blog/how-to-kill-mysql-queries/ | Last Update : Fri, 05 Feb 21
Question : mysql kill
Answered by : exuberant-echidna-bbj8cy2kp97p
-- 查询执行时间超过2分钟的线程,然后拼接成 kill 语句
select concat('kill ', id, ';')
from information_schema.processlist
where command != 'Sleep'
and time > 2*60
order by time desc
Source : https://www.cnblogs.com/duhuo/p/5678286.html | Last Update : Thu, 09 Dec 21