Search the MySQL manual:

4.5.6 KILL Syntax

KILL thread_id

Each connection to mysqld runs in a separate thread. You can see which threads are running with the SHOW PROCESSLIST command and kill a thread with the KILL thread_id command.

If you have the PROCESS privilege, you can see all threads. If you have the SUPER privilege, you can kill all threads. Otherwise, you can only see and kill your own threads.

You can also use the mysqladmin processlist and mysqladmin kill commands to examine and kill threads.

Note: You currently cannot use KILL with the Embedded MySQL Server library, because the embedded server merely runs inside the threads of the host application, it does not create connection threads of its own.

When you do a KILL, a thread-specific kill flag is set for the thread.

In most cases it may take some time for the thread to die as the kill flag is only checked at specific intervals.

User Comments

Posted by [name withheld] on Thursday July 10 2003, @8:41am[Delete] [Edit]

Would be advantageous to have an immediate kill command - currently have a v3.23 db that is locked up (I believe waiting on a thread) the thread cannot be killed so the only hope I have is to kill the whole db :(

Add your own comment.