The server killed your session, usually via a KILL command or resource manager, and the connection is closed with SQLSTATE HY000.
ER_SESSION_WAS_KILLED (MySQL error 3169) signals that the server forcibly ended your session or query. Reconnect, identify who or what issued the KILL command, tune long-running queries, and restrict privileges to stop the error from reoccurring.
ER_SESSION_WAS_KILLED
Error 3169 appears when MySQL shuts down your current session and returns the message "Session was killed" with SQLSTATE HY000.
The server issues this only when another thread executes KILL QUERY, KILL CONNECTION, or KILL , or when InnoDB protection mechanisms terminate runaway sessions.
Because the connection disappears immediately, any uncommitted work is rolled back, and clients must reconnect to continue.
The error surfaces the moment the server processes the KILL request or internal kill logic. It is common during long-running analytics queries, deadlock resolution, or manual DBA intervention.
MySQL 5.7.9 and later include this error code, so older clients may see only "Lost connection" instead.
Unexpected session kills corrupt user experience, roll back transactions, and break application workflows. Investigating the root cause helps maintain stability and data integrity.
DBAs sending KILL statements to stop blocking or resource-heavy sessions trigger the error instantly.
The MySQL Resource Group feature or InnoDB monitor can also kill sessions that exceed timeouts or memory limits.
Connection pool managers or automated scripts may issue KILL to recycle idle or orphaned sessions.
First, reconnect to the database so the application can resume work.
Next, query the process list or MySQL error log to find who issued the KILL and why.
Finally, adjust query patterns, indexes, or privileges so the session no longer becomes a candidate for termination.
Long-running report queries get killed by a DBA during peak hours - move them to off-hours or add covering indexes.
Idle sessions pile up and exceed max_connections - enable wait_timeout and interactive_timeout to close them gracefully instead of KILL.
Automated health checks misidentify slow queries - refine monitoring thresholds or whitelist critical jobs.
Monitor slow queries with PERFORMANCE_SCHEMA and tune them before they affect production.
Use proper transaction scope: commit or rollback quickly to avoid locks.
Restrict KILL privileges only to DBAs and automation you trust.
Leverage Galaxy editor to profile query plans and share optimized versions with teammates, reducing the need for emergency kills.
Error 2013 Lost connection - usually network, not an intentional kill.
Error 1213 Deadlock found - transaction rolled back by InnoDB, not a manual kill.
Error 3024 Query killed (ER_QUERY_TIMEOUT) - automatic timeout rather than explicit KILL.
DBA or automation executes KILL CONNECTION or KILL QUERY on the session.
InnoDB kills threads that exceed innodb_kill_idle_transaction.
Orchestrators terminate sessions considered stale or zombie.
Long-running queries are killed to protect CPU or lock availability.
Query execution was interrupted, often by the same KILL mechanism but before the session ends.
Query exceeded the configured execution timeout; session remains alive.
InnoDB aborted your transaction to resolve a deadlock, not a manual kill.
Yes. When the server ends your session, all uncommitted changes are rolled back automatically.
Restrict KILL, SUPER, and PROCESS privileges to trusted accounts. Ordinary users cannot kill sessions they do not own.
No. A network issue shows Error 2013 Lost connection, while ER_SESSION_WAS_KILLED is a deliberate server action.
Galaxy highlights slow queries, suggests indexes, and lets teams endorse optimized SQL, reducing the chance that a DBA will kill your sessions.