dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Home/Error Library/mysql-lock-wait-timeout
MySQL
MySQL 8.0 / 8.4Lock & Deadlock
5 min read
ERROR 1205 (HY000): Lock wait timeout exceeded

MySQL "Lock wait timeout exceeded" — Who Holds the Lock and Who to KILL?

Finding the blocking transaction using performance_schema, safe KILL decision matrices, and permanent locking reduction.

Reviewed by:Senior Database Architect & SRE (dataiotech Labs)
Tested Versions: MySQL 8.0 / 8.4 LTS
First 60 Seconds Emergency Protocol:

The error string is a symptom, not the root cause. Do not restart the server blindly. Run the diagnostic queries below to pinpoint the actual failure mode.

▸Symptom

plaintext
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

Unlike a deadlock, there is no cycle. A transaction simply waited longer than innodb_lock_wait_timeout (default 50s).


▸Find the Blocker

sql
SELECT w.requesting_engine_transaction_id, w.blocking_engine_transaction_id, b.trx_mysql_thread_id, TIMESTAMPDIFF(SECOND, b.trx_started, NOW()) AS duration_sec, b.trx_query AS blocker_query, r.trx_query AS waiting_query FROM performance_schema.data_lock_waits w JOIN information_schema.innodb_trx b ON b.trx_id = w.blocking_engine_transaction_id JOIN information_schema.innodb_trx r ON r.trx_id = w.requesting_engine_transaction_id;
  • •Validated versions: MySQL 8.0 / 8.4 LTS

Other Database Error Triage Playbooks

Other battle-tested diagnostic guides for high-severity database errors.

All Errors (20)