If you have a “hanging” process in MySQL and want to kill it, you use show processlist to identify the process you want to kill get get the id. Then a simple kill ID will do the job.
mysql> show processlist; +-----+------+-----------+---------+---------+-------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +-----+------+-----------+---------+---------+-------+-------+------------------+ | 882 | user | localhost | test | Sleep | 27111 | | NULL | | 893 | user | localhost | test | Sleep | 453 | | NULL | | 901 | user | localhost | NULL | Query | 0 | NULL | show processlist | +-----+------+-----------+---------+---------+-------+-------+------------------+ 3 rows in set (0.00 sec) mysql> kill 882
The same can be done using mysqladmin form the command line:
[root@host]# mysqladmin processlist
+-----+------+-----------+---------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+-----------+---------+---------+------+-------+------------------+
| 882 | prog | localhost | test | Sleep | 2676 | | |
| 893 | prog | localhost | | Sleep | 1823 | | |
| 903 | root | localhost | | Query | 0 | | show processlist |
+-----+------+-----------+---------+---------+------+-------+------------------+
[root@host]#
[root@host]# mysqladmin kill 882
February 18th, 2013 at 9:03 am
Haha, planet mysql has a series currently on just this:
http://mysqlentomologist.blogspot.nl/2013/02/when-kill-flag-is-checked-for-select.html
http://mysqlentomologist.blogspot.nl/2013/02/when-kill-flag-is-checked-for-select_17.html