Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 022010

How to check and kill long running MySQL query


1. Get into the MySQL shell, type 'SHOW PROCESSLIST' to see which query is blocking


2. It will print out all the current executing queries, and you will find the thread Id.


| Id | User  | Host            | db   | Command | Time| State     | Info                                                                                           

| 3928 |root  | |db1 |Query    | 84   | Locked  |

select * from table1 where name like '%test%' 

3. Remember this Id, to kill it, use the "KILL" command

mysql> KILL 3928;

Query OK, 0 rows affected (0.05 sec)

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>