MySQL cannot locate the necessary tablespace or .ibd file even though the .frm exists, preventing the table from opening.
MySQL Error 1016: ER_CANT_OPEN_FILE means InnoDB cannot find or access the table’s physical tablespace on disk, even though its .frm definition file is present. Check the table’s .ibd location, verify file permissions, and run ALTER TABLE ... DISCARD/IMPORT TABLESPACE or restore from backup to resolve the problem.
Can't open file: '%s' (errno: %d - %s)
MySQL throws "Can't open file: '%s' (errno: %d - %s)" when the InnoDB engine cannot locate or read the tablespace (.ibd) referenced by the table’s .frm metadata. The SQLSTATE is HY000, signaling a general storage engine failure.
Although the .frm file still exists in the database directory, the corresponding data file is missing, moved, corrupted, or locked by the operating system.
The server therefore blocks any query needing that table.
The error appears during SELECT, INSERT, UPDATE, or ALTER statements, and on server start-up if InnoDB scans the data dictionary and fails to open the table. It often follows filesystem operations or crashes.
Leaving the table inaccessible halts application features that rely on it, risks cascading failures, and hints at deeper storage issues.
Rapid diagnosis protects data integrity and uptime.
InnoDB cannot map the logical table to its physical .ibd file because the file is missing, renamed, has the wrong permissions, or resides on a detached volume.
Mismatched table IDs after a partial restore also trigger the error.
A crash during an ALTER TABLE that copied data out and back can leave the new .ibd orphaned, breaking the metadata link.
First, validate that the .ibd file exists in the database directory. If it is missing, locate a recent backup and copy it back.
Second, ensure the file owner and permission bits allow mysqld to read and write.
If the .ibd exists but the internal table ID mismatches, use ALTER TABLE tbl DISCARD TABLESPACE; followed by ALTER TABLE tbl IMPORT TABLESPACE; after placing a valid .ibd copy in the directory. Always run ANALYZE TABLE after import.
Scenario: you renamed the table’s folder at the OS level.
Solution: revert the folder name or update the datadir, then restart MySQL.
Scenario: the disk filled, causing corruption. Solution: free space, run mysqlcheck --repair or InnoDB recovery mode 1, then test.
Never manipulate .ibd or .frm files directly; use SQL commands. Keep regular logical and physical backups. Monitor disk health and permissions with automated checks.
Enable innodb_file_per_table and ensure backups capture both .frm and .ibd files.
Verify restore scripts on staging regularly.
Error 1146 (ER_NO_SUCH_TABLE) occurs when both .frm and .ibd are missing. Error 1030 (ER_GET_ERRNO) indicates general filesystem errors. These share root causes and similar repair steps but differ in missing metadata scope.
Error 1812 (Tablespace is missing for table) specifically flags lost .ibd files in newer MySQL versions and can be resolved with the same DISCARD/IMPORT workflow.
.
A simple restart rarely resolves the missing file. It may even prevent startup if the table loads at boot.
You can drop the table to silence the error, but verify no code references it and back up data first.
Galaxy surfaces schema changes, discourages manual filesystem edits, and tracks ALTER TABLE statements, reducing human error.
Yes when using verified backups and running inside a transaction window. Always test on staging first.