The storage engine found an outdated or corrupt .MYI key file for the specified MyISAM table and demands a repair before further use.
MySQL Error 1035: ER_OLD_KEYFILE appears when MySQL detects an outdated or corrupt .MYI key file for a MyISAM table. Run REPAIR TABLE, myisamchk, or restore a clean backup to fix the corruption and resume normal queries.
Old key file for table '%s'; repair it!
MySQL throws Error 1035 when the MyISAM storage engine finds that the table’s .MYI key file is older than the .MYD data file or is corrupted. The mismatch stops reads and writes until a repair recreates the index file.
The error protects data integrity. Ignoring it can leave indexes out of sync, cause wrong result sets, and risk further corruption.
Quick repair is essential in production environments.
Unclean shutdowns, disk full events, or file-system issues can leave the .MYI index file with stale metadata.
When MySQL restarts, it sees the key file timestamp older than the data file and raises Error 1035.
Manual file copying, failed ALTER TABLE commands, or running different MySQL versions on the same data directory also create version mismatches that trigger ER_OLD_KEYFILE.
First attempt an in-place repair with REPAIR TABLE table_name QUICK. If that fails, run a full REPAIR or use myisamchk with the server stopped.
Always back up the .MYD and .MYI files before repairing.
If corruption is severe, restore the affected table from a tested backup, then run FLUSH TABLES to refresh the file descriptors. Galaxy users can execute these commands directly in the editor and commit the repaired query to a shared Collection for auditability.
Servers killed by SIGKILL often leave orphaned .MYI files.
Restart in read-only mode, copy data, then repair offline with myisamchk —fast to minimize downtime.
Disk full incidents corrupt partially written key blocks. Free disk space, copy the table files, and run myisamchk —recover to rebuild indexes safely.
Schedule regular OPTIMIZE TABLE or mysqlcheck —optimize to keep key files healthy. Use innodb_file_per_table and migrate to InnoDB when possible to avoid MyISAM-specific risks.
Enable automatic backups and monitor disk health.
Galaxy’s run history and role-based access help prevent risky manual file operations that often cause ER_OLD_KEYFILE.
Error 126 (HY000): Index file is crashed - similar index corruption fixed with REPAIR TABLE.
Error 1194 (HY000): Table is marked as crashed - caused by corrupt .MYD, requiring myisamchk or restore.
.
A power loss or kill ‑9 stops MySQL mid-write, leaving the .MYI index file inconsistent with the .MYD data file.
When disk space runs out, index writes fail partially, producing outdated or corrupt key blocks detected at next access.
Copying only the .MYD file without its matching .MYI file between servers breaks the internal timestamp consistency.
Running different MySQL versions on the same data directory changes index formats and causes ER_OLD_KEYFILE on restart.
.
REPAIR TABLE rebuilds only the index file. Data rows stay intact, but always back up before running the command.
No. The server blocks queries on the affected table until you repair it to prevent inconsistent results.
InnoDB uses transactional storage and avoids .MYI files, eliminating ER_OLD_KEYFILE, but you must test the migration carefully.
Galaxy’s editor lets you run REPAIR TABLE quickly, version the fix, and share it with peers, reducing human error and downtime.