MySQL reports ER_FILE_CORRUPT when it detects a damaged table or index file during read, write, or startup.
MySQL ER_FILE_CORRUPT (HY000 3000) means the server detected a corrupted table or index file. Stop writes, back up the file, then repair or rebuild the table with REPAIR TABLE for MyISAM or ALTER TABLE for InnoDB to resolve the issue.
ER_FILE_CORRUPT
MySQL raises the ER_FILE_CORRUPT error when it opens, reads, or writes a table file and detects structural damage. The server logs the message File %s is corrupted and stops the current statement to avoid further data loss.
The error appears during SELECT, INSERT, UPDATE, OPTIMIZE TABLE, ALTER TABLE, or server startup while recovering the data directory. It signals that at least one data, index, or system dictionary file on disk no longer matches the expected format.
Unexpected shutdowns, power loss, or kernel panics can interrupt active writes and leave a table file in an inconsistent state.
Hardware faults such as failing disks, controller errors, or unreliable network storage silently corrupt pages that MySQL later reads.
File system bugs, especially on network or clustered file systems, may truncate or reorder writes, corrupting InnoDB or MyISAM files.
Manual file copy, rsync, or antivirus software modifying .ibd, .frm, or .myd files outside MySQL can break internal checksums.
First, identify which table is damaged by reviewing the error log or the placeholder in the error message. Stop writes to reduce further corruption.
For InnoDB tables in file-per-table mode, run an online table rebuild. If that fails, take a backup of the .ibd file, drop the table, restore, and import using DISCARD and IMPORT TABLESPACE.
For MyISAM tables, execute REPAIR TABLE or myisamchk in maintenance mode. Always back up the .MYD and .MYI files before repair.
If the corruption is severe, restore the table or database from a recent logical or physical backup and verify consistency with CHECK TABLE.
During ALTER TABLE, ER_FILE_CORRUPT often points to a new temporary .ibd file. Restart the server and run ALTER TABLE FORCE to rebuild safely.
If the server fails to start with ER_FILE_CORRUPT, start mysqld with innodb_force_recovery=1, dump the affected data, then recreate the schema on a clean instance.
Use reliable storage with battery-backed write cache and an enterprise-grade file system to minimize silent corruption.
Enable MySQL checksums, run periodic CHECK TABLE, and monitor the error log for early warning signs.
Schedule regular logical and physical backups so that corrupted objects can be restored quickly.
Avoid touching database files outside MySQL. Perform all maintenance through SQL or the MySQL shell. Galaxy signatures and version control make this straightforward.
InnoDB: Page corruption detected at page means low-level block damage and often appears with ER_FILE_CORRUPT. Similar repair steps apply.
ERROR 126 (HY000) - Index file is crashed occurs in MyISAM and is fixed by REPAIR TABLE.
ERROR 144 (HY000) - Table is crashed is another MyISAM counterpart that can be repaired or restored from backup.
Sudden power loss or kill -9 interrupts MySQL while flushing pages, leaving partial writes that invalidate internal checksums.
Bad blocks, failing SSD cells, or network file system glitches silently corrupt table files that MySQL later reads.
Copying or editing .ibd, .frm, .myd, or .myi files outside MySQL can desynchronize metadata and trigger ER_FILE_CORRUPT.
Older MySQL versions and third-party storage engines contain defects that occasionally write wrong page headers or sizes.
Occurs when a MyISAM .MYI file is damaged. Fixed by REPAIR TABLE or myisamchk.
Indicates a corrupted MyISAM .MYD file. Repair or restore the data part of the table.
Signals page-level damage in InnoDB. Requires innodb_force_recovery and logical dump.
Appears when mysqld starts with innodb_force_recovery. Reduce the level after dumping and restoring data.
Small InnoDB tables can be rebuilt online with ALTER TABLE, but extensive corruption usually requires maintenance mode or a replica promotion.
No. REPAIR TABLE only applies to MyISAM. Use ALTER TABLE or logical export and import for InnoDB damage.
Yes if the corrupted pages are read and binlogged. Promote a healthy replica or restore from backup to avoid spreading the issue.
Galaxy tracks query versions and encourages server-side operations, preventing manual file edits that commonly cause ER_FILE_CORRUPT.