Is it possible to kill all mySQL processes at once, except for one process id?
Asked
Active
Viewed 3,599 times
0
-
1Which OS are you using? Why do even you need to kill the processes? – YasirA May 27 '13 at 22:55
-
linux, i have one long running query, and want all others to be ended on command, but not that one. – d-_-b May 27 '13 at 22:56
-
do you mean OS process id's or mysql connection id's ? – Drew May 27 '13 at 23:01
-
1hey i think it is a great question and answer from Johan. at least you can learn something from it, why the downvote ! :> – Drew May 27 '13 at 23:06
1 Answers
4
You can use the information_schema table for that, its a bit of a hassle but it works ;)
mysql> select concat('KILL ',id,';') from information_schema.processlist
where id != '1234' into outfile '/tmp/foo.txt';
mysql> source /tmp/foo.txt;

Johan
- 1,958
- 11
- 20