代码改变世界

【MySQL】MySQL批量KILL线程

2022-08-04 09:45  abce  阅读(573)  评论(0编辑  收藏  举报

1.使用pt-kill工具

pt-kill --user=root --password=123456 -hlocalhost --no-version-check --match-command Query --match-state "Sending data" --victims all --interval 2 --print --kill

  

2.SQL拼接

select concat('KILL ',id,';') from information_schema.processlist where Command='Query' and STATE='Sending data';