1678
MySQLERRORCommonInnoDBHIGH confidence
Tablespace has been discarded
Production Risk
High — all queries on the table fail until the tablespace is imported.
What this means
The tablespace for this table has been discarded via ALTER TABLE ... DISCARD TABLESPACE. All DML operations fail until a new tablespace is imported.
Why it happens
- 1ALTER TABLE ... DISCARD TABLESPACE was executed, removing the .ibd file reference.
- 2The table is in a discarded state pending an IMPORT TABLESPACE operation.
How to reproduce
trigger — this will error
trigger — this will error
SELECT * FROM t; -- after ALTER TABLE t DISCARD TABLESPACE
expected output
ERROR 1678 (HY000): Tablespace has been discarded for table 't'.
Fix
Import the tablespace to restore access
Import the tablespace to restore access
-- Copy .ibd (and .cfg if available) into the data directory, then: ALTER TABLE t IMPORT TABLESPACE;
Why this works
IMPORT TABLESPACE reattaches the .ibd file, making the table accessible again.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1678 ER_TABLESPACE_DISCARDED
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev