mysql kill all processes code example
Example 1: kill mysql processlist in whose time more than 200
mysql> select group_concat(concat('KILL ',id,';')) from
information_schema.processlist where user='root' and time > 500;
mysql> source /tmp/a.txt;
Example 2: bulk kill mysql processlist
SELECT CONCAT('KILL ',id,';') AS IDs
FROM information_schema.processlist
WHERE TIME >10
AND command = "sleep"
Example 3: mysql kill
mysql> SELECT GROUP_CONCAT(CONCAT('KILL ',id,';') SEPARATOR ' ')
FROM information_schema.processlist WHERE user <> 'system user';
Example 4: kill all mysql processes
sudo killall mysqld