1219
MySQLERRORNotableLockingHIGH confidence

Active locked tables or transaction prevents this command

Production Risk

Low — no data affected; resolve lock state and retry.

What this means

ER_LOCK_OR_ACTIVE_TRANSACTION (1219, SQLSTATE HY000) is raised when a command cannot be executed because the session has active locked tables (via LOCK TABLES) or an open transaction.

Why it happens
  1. 1Running a command that requires exclusive access while LOCK TABLES is in effect
  2. 2Attempting certain administrative commands inside an open transaction
How to reproduce
trigger — this will error
trigger — this will error
LOCK TABLES t1 READ;
FLUSH TABLES WITH READ LOCK;  -- may trigger 1219

expected output

ERROR 1219 (HY000): Can't execute the given command because you have active locked tables or an active transaction

Fix

Unlock tables and commit/rollback before running the command

Unlock tables and commit/rollback before running the command
UNLOCK TABLES;
COMMIT;
-- Now run the intended command

Why this works

Releasing locks and closing the transaction frees the session for administrative operations.

Sources
Official documentation ↗

MySQL 8.0 — 1219 ER_LOCK_OR_ACTIVE_TRANSACTION

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

← All MySQL errors