Name
KILL
Synopsis
KILL [CONNECTION|QUERY] threadUse this statement to terminate a
client connection to MySQL. You can use the SHOW
PROCESSLIST statement to obtain a connection thread
identifier. As of Version 5, you can use
CONNECTION or QUERY flags to
distinguish between terminating a connection or terminating just the
query associated with the connection for the given thread. Some
processes cannot be terminated immediately. Instead, this statement
flags the process for termination. The system may not check the flag
until the process is completed. This will occur with statements such
as REPAIR TABLE.
Here is an example of this statement:
KILL 22;
This simple example terminates the connection for the client associated with the thread identifier 22. If that client attempts to issue another SQL statement, it will receive an error 2006 message stating that the MySQL server has gone away. Then it typically will try to reconnect to the server, establish a new thread, and run the requested query.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access