Stopping a specific slow query without disconnecting the application. KILL [CONNECTION] ;
Run SHOW FULL PROCESSLIST; in your MySQL client. ID: The unique identifier needed for the kill command. Time: How long (in seconds) the query has been running.
If you have many connections, use a standard SELECT to find specific slow queries: kill mysql query
| Step | Action | | :--- | :--- | | 1 | SHOW FULL PROCESSLIST; to find the ID. | | 2 | Evaluate risk (read vs. write, time elapsed). | | 3 | KILL [QUERY] id; | | 4 | Monitor SHOW PROCESSLIST; to confirm termination. | | 5 | If stuck, wait or investigate deeper issues. |
Tells you if it's "Sending data," "Locked," or "Waiting for table metadata lock". Info: The actual SQL text being executed. Stopping a specific slow query without disconnecting the
SHOW PROCESSLIST;
However, killing a connection (which includes all queries within that connection) requires SUPER privilege: Time: How long (in seconds) the query has been running
To stop the execution of a specific SQL statement while keeping the user connected, use: KILL QUERY ; Use code with caution.
KILL CONNECTION ; -- or simply KILL ; Use code with caution. MySQL 9.7 Reference Manual :: 15.7.8.4 KILL Statement