MySQL Client and Connection Cheatsheet/Kill a running connection

Terminate a session by connection id.

Section: script-friendly client patterns

Kill a running connection

sql
sql
KILL 12345;
Explanation

Use carefully in production; get the connection id from `SHOW PROCESSLIST`.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing script-friendly client patterns
Show active sessions
Inspect current client connections and statements.
OpenIn sheetsqlsame section
Query without column headers
Print raw rows for scripts and pipelines.
OpenIn sheetbashsame section
Use batch mode for parsable output
Reduce formatting for machine-friendly results.
OpenIn sheetbashsame section
Log an interactive session to a file
Write statements and output to a transcript file.
OpenIn sheetsqlsame section
Show connection status in the mysql client
Display host, connection id, server version, and current database.
OpenIn sheetsqlsame section
Connect to a local MySQL server
Open an interactive mysql session.