Skip to content

Cancel or kill a query in MySQL

Use KILL QUERY to stop a statement while keeping its connection open. Use KILL CONNECTION to end the session.

Identify the target session in the current database:

SELECT ID, USER, DB, HOST, COMMAND, TIME, STATE, INFO
FROM information_schema.PROCESSLIST
WHERE DB = DATABASE()
ORDER BY TIME DESC;

Use the ID in the command you need. Here, 123 is an example:

Command Effect
KILL QUERY 123; Stops the current statement; the connection and any open transaction remain.
KILL CONNECTION 123; Closes the session; MySQL rolls back an active InnoDB transaction.

KILL 123 is another spelling of KILL CONNECTION 123. Transaction rollback can take time after termination.

  1. Open Admin › Connections.
  2. Select the session and check its PID, user, database, and query.
  3. Choose Cancel Query to stop the statement, or Kill Connection to end the session.
  4. Review the confirmation and complete any required password prompt.

These controls apply the connection’s query guardrails. The list is scoped to the current database.

For your own running editor query, use the cancellation controls described in write and run SQL.

PROCESS permits visibility of other accounts’ sessions. Visibility does not grant permission to stop them.

On MySQL 8, stopping another account’s session requires CONNECTION_ADMIN or SUPER. A target session with SYSTEM_USER also requires SYSTEM_USER in your session. See MySQL’s KILL reference.

Managed services can impose additional restrictions. If access is denied, ask the administrator to review the exact session and command; use Admin data troubleshooting for access checks.

Use view locks to identify blockers before taking action. For a query that remains active, see slow queries and timeouts. Return to the MySQL overview.