Mysql Mass Kill

This method I use to do mass kill on mysql process. After run “show processlist” and notice something.

mysql> select concat('KILL ',id,';') from information_schema.processlist
 where Host like '%oss%' and time > 200 into outfile '/tmp/lock.txt';
mysql> source /tmp/lock.txt;

done.. all the process where host like oss and time more than 200.

References:
mysqlperformanceblog, stackoverflow
tested  on centos 6.5 mysql 5.5

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s