1725
MySQLERRORCommonInnoDBHIGH confidence
Table is being used in a foreign key check and cannot be modified
Production Risk
High — DDL is blocked; production traffic may cause extended wait.
What this means
InnoDB prevents DDL on a table while a foreign key constraint check is being performed on it, to avoid inconsistencies.
Why it happens
- 1Concurrent DML or DDL is triggering FK checks on the same table.
- 2Attempting ALTER TABLE on a table referenced in a cascading FK while FK checks are running.
How to reproduce
trigger — this will error
trigger — this will error
-- Concurrent session running DELETE with ON DELETE CASCADE while another runs ALTER TABLE.
expected output
ERROR 1725 (HY000): Table is used in foreign key check.
Fix
Retry the DDL after the FK check completes
Retry the DDL after the FK check completes
-- Wait for active transactions to complete, then: ALTER TABLE referenced_table ADD COLUMN new_col INT;
Why this works
InnoDB releases the FK check lock once the triggering transaction commits or rolls back.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1725 ER_TABLE_IN_FK_CHECK
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev