1428
MySQLerrortransactionshigh confidence
Can't combine WRITE locks for system and user tables
Production Risk
Low — LOCK TABLES fails; no locks acquired.
What this means
A LOCK TABLES statement tried to acquire WRITE locks on both a MySQL system table and a user table simultaneously, which is not permitted.
Why it happens
- 1LOCK TABLES mysql.user WRITE, my_table WRITE in the same statement
How to reproduce
trigger — this will error
trigger — this will error
LOCK TABLES mysql.user WRITE, my_table WRITE;
expected output
ERROR 1428 (HY000): You can't combine WRITE locks for system and user tables
Fix
Lock system and user tables in separate LOCK TABLES calls
Why this works
Separate the system table locks from user table locks.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1428 ER_WRONG_LOCK_OF_SYSTEM_TABLE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev