3212
MariaDBERRORCommonInnoDB / StorageHIGH confidence
InnoDB tablespace (.ibd) file is missing
Production Risk
Critical — table is inaccessible until resolved.
Why it happens
- 1The .ibd file for an InnoDB table was deleted or moved outside of MySQL.
- 2Moving the data directory without copying all tablespace files.
- 3Accidental file system deletion.
How to reproduce
trigger — this will error
trigger — this will error
SELECT * FROM t1;
expected output
ERROR 3212 (HY000): Tablespace is missing for table 'db/t1'.
Fix 1
Restore from backup
Restore from backup
-- Restore the .ibd file from the most recent backup.
Why this works
Restoring the tablespace file allows InnoDB to reopen the table.
Fix 2
Discard and import tablespace
Discard and import tablespace
ALTER TABLE t1 DISCARD TABLESPACE; -- then copy backup .ibd -- ALTER TABLE t1 IMPORT TABLESPACE;
Why this works
Allows importing a clean .ibd file from backup.
Fix 3
Drop and recreate the table if data is expendable
Drop and recreate the table if data is expendable
DROP TABLE IF EXISTS t1; CREATE TABLE t1 (...);
Why this works
Only viable if data loss is acceptable.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3212 ER_MISSING_TABLESPACE_FILE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev