many times because an exception or a program error can cause individual processes to consume a large amount of system resources and need to end these processes, you can usually use the following command kill process:
The process of killing all the lock tables in MySQL 2009-05-12 14:03
Reprint please retain the following author information
Author: Jesse
Blog: Http://hi.baidu.com/leechl
3 o'clock just slept, more than 4, the colleague called to tell me that the user database was hung off. I get up and look at the list of processes.
MySQL > Show processlist ;
Out of several screens, no 1000 also have hundreds of, query statements to lock the table, hurriedly find the first locked thread_id, in the shell of MySQL execution.
MySQL > Kill thread_id ;
The process of killing the first lock table still does not improve. Since it doesn't improve, let's try to kill all the lock-list processes, the simple script is as follows.
#!/bin/bash
MySQL - u Root - e " Show Processlist " | grep - I " Locked " >> Locked_log . txt
for Line inch ` Cat Locked_log.txt | awk ' {print $ } ' `
Do
Echo " Kill $line ; " >> kill_thread_id . SQL
Done
Now Kill_thread_id.sql's content looks like this.
Kill 66402982 ;
Kill 66402983 ;
Kill 66402986 ;
Kill 66402991 ;
.....
Well, we execute it in the shell of MySQL and we can kill all the lock-list processes.
MySQL > Source kill_thread_id . SQL
of course, it can be done in one line.
for   id in " mysqladmin processlist | grep-i Locked | awk ' {print $1 } ' '