3382
MySQLERRORNotableLockingHIGH confidence

Cannot lock system table in this context

Production Risk

Low — lock attempt fails; no tables are locked.

How to reproduce
trigger — this will error
trigger — this will error
LOCK TABLES mysql.user WRITE;

expected output

ERROR 3382 (HY000): Cannot acquire lock on system table.

Fix

Use FLUSH PRIVILEGES instead

Use FLUSH PRIVILEGES instead
FLUSH PRIVILEGES;

Why this works

FLUSH PRIVILEGES atomically reloads grant tables without requiring explicit locks.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3382 ER_WRONG_LOCK_OF_SYSTEM_TABLE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors