1926
MySQLERRORNotableLockingHIGH confidence
Cannot lock log table for write
Production Risk
Low — operation is rejected; no data is lost.
What this means
MySQL refused a write lock on a log table (general_log or slow_log) because log tables have special locking semantics that prevent explicit write locks.
Why it happens
- 1LOCK TABLES general_log WRITE or LOCK TABLES slow_log WRITE.
- 2Attempt to acquire an explicit write lock on a log table in a transaction.
How to reproduce
trigger — this will error
trigger — this will error
LOCK TABLES mysql.general_log WRITE;
expected output
ERROR 1926 (HY000): Cannot lock log table for write.
Fix
Do not lock log tables explicitly
Do not lock log tables explicitly
-- Access log tables with regular SELECT; do not use LOCK TABLES on them
Why this works
Log tables use internal locking; external write locks are not permitted.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1926 ER_CANT_WRITE_LOCK_LOG_TABLE2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev