Monday, January 21, 2013

Kill all threads from a MySQL user

Kill all threads from a MySQL user

Terminal - Kill all threads from a MySQL user 
mysql -BNe "SELECT id FROM processlist WHERE user = 'redmine';" information_schema | while read id; do mysqladmin kill $id; done

Kill all threads from a MySQL user
Kills all the threads from the user provided in the WHERE request.

Alternatives

Terminal - Alternatives 
for i in `mysqladmin -h x.x.x.x --user=root -pXXXX processlist | grep <<username>>| grep <<Locked>>| awk {'print $2'}` do mysqladmin -h x.x.x.x --user=root -pXXX kill $i; done;

No comments:

Post a Comment