1596
MariaDBERRORNotableLoggingHIGH confidence
Cannot write-lock a log table
Production Risk
Low — the LOCK fails; logging continues normally.
What this means
A write lock cannot be acquired on a log table (general_log or slow_log) while logging is active.
Why it happens
- 1Attempting LOCK TABLES ... WRITE on mysql.general_log or mysql.slow_log while the log is enabled.
How to reproduce
trigger — this will error
trigger — this will error
LOCK TABLES mysql.general_log WRITE;
expected output
ERROR 1596 (HY000): You can't use locks with log tables.
Fix
Disable the log before locking
Disable the log before locking
SET GLOBAL general_log = 'OFF'; LOCK TABLES mysql.general_log WRITE; -- perform operations UNLOCK TABLES; SET GLOBAL general_log = 'ON';
Why this works
Log tables cannot be write-locked while actively being written to by the logging system.
Sources
Official documentation ↗
MySQL 8.0 — 1596 ER_CANT_WRITE_LOCK_LOG_TABLE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev