Kill Multiple MySQL Queries

SELECT 
    GROUP_CONCAT(CONCAT('KILL ', id, ';')
        SEPARATOR ' ')
FROM
    information_schema.processlist
WHERE
    user <> 'system user';
    
SELECT 
    GROUP_CONCAT(CONCAT('KILL ', id, ';')
        SEPARATOR ' ')
FROM
    information_schema.processlist
WHERE
    Command <> 'Slepp';
    
#kill the query being implemented by a thread and leave the connection active, 
#use the KILL QUERY command instead. 
SELECT 
    GROUP_CONCAT(CONCAT('KILL QUERY ', id, ';')
        SEPARATOR ' ')
FROM
    information_schema.processlist
WHERE
    Command <> 'Slepp';


https://gist.github.com/i88ca/cea1853ed4f548caa2c7f611f2c41b5b

Popular posts from this blog

How to delete / clear queue of PowerMTA