Common SQL Errors

MySQL Error 3000: ER_FILE_CORRUPT - File is corrupted How to Fix and Prevent

Galaxy Team
August 8, 2025

MySQL reports ER_FILE_CORRUPT when it detects a damaged table or index file during read, write, or startup.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error ER_FILE_CORRUPT (HY000/3000)?

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.

Error Highlights

Typical Error Message

ER_FILE_CORRUPT

Error Type

Storage Error

Language

MySQL

Symbol

Error Code

3000

SQL State

HY000

Explanation

Table of Contents

What is MySQL error ER_FILE_CORRUPT (HY000/3000)?

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.

What Causes This Error?

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.

How to Fix ER_FILE_CORRUPT

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.

Common Scenarios and Solutions

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.

Best Practices to Avoid This Error

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.

Related Errors and Solutions

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.

Common Causes

Unexpected shutdown during write

Sudden power loss or kill -9 interrupts MySQL while flushing pages, leaving partial writes that invalidate internal checksums.

Hardware or file system failure

Bad blocks, failing SSD cells, or network file system glitches silently corrupt table files that MySQL later reads.

Manual file manipulation

Copying or editing .ibd, .frm, .myd, or .myi files outside MySQL can desynchronize metadata and trigger ER_FILE_CORRUPT.

Software bugs

Older MySQL versions and third-party storage engines contain defects that occasionally write wrong page headers or sizes.

Related Errors

ERROR 126 - Index file is crashed

Occurs when a MyISAM .MYI file is damaged. Fixed by REPAIR TABLE or myisamchk.

ERROR 144 - Table is crashed

Indicates a corrupted MyISAM .MYD file. Repair or restore the data part of the table.

InnoDB page corruption detected

Signals page-level damage in InnoDB. Requires innodb_force_recovery and logical dump.

ER_INNODB_FORCED_RECOVERY

Appears when mysqld starts with innodb_force_recovery. Reduce the level after dumping and restoring data.

FAQs

Can I repair ER_FILE_CORRUPT without downtime?

Small InnoDB tables can be rebuilt online with ALTER TABLE, but extensive corruption usually requires maintenance mode or a replica promotion.

Does REPAIR TABLE work for InnoDB?

No. REPAIR TABLE only applies to MyISAM. Use ALTER TABLE or logical export and import for InnoDB damage.

Will replication propagate corruption?

Yes if the corrupted pages are read and binlogged. Promote a healthy replica or restore from backup to avoid spreading the issue.

How does Galaxy help?

Galaxy tracks query versions and encourages server-side operations, preventing manual file edits that commonly cause ER_FILE_CORRUPT.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo