How to Kill a Query in MySQL

Last updated July 25, 2026 · By the SaturnSQL team

Find the connection id with SHOW PROCESSLIST, then KILL QUERY id stops the running statement but keeps the connection, while KILL id (KILL CONNECTION) drops the whole session.

SHOW FULL PROCESSLIST;

Find long-running queries

SELECT id, user, time, LEFT(info, 100) AS query
FROM information_schema.processlist
WHERE command <> 'Sleep' AND time > 60
ORDER BY time DESC;

Kill it

Killing a statement that modified rows triggers a rollback, which can take as long as the work already done.

KILL QUERY 4321;
KILL 4321;

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related MySQL guides

© 2026 Panda Capital Oy Ab. All rights reserved.