MySQL "Incorrect key file for table" error
Posted June 24th, 2009 in MySql
When saving a record to a MySQL table the other day I got the error message "Incorrect key file for table 'mytable'; try to repair it". I am uncertain why the error occured and how to ensure it doesn't happen again in the future but a quick fix for the time being is simple.
How to repair a MySQL table
All you need to do is to repair the table by running the following SQL command, where "mytable" is the name of the table that gave the error:
REPAIR TABLE `mytable`;
You can run this from e.g. the MySQL CLI or phpMyAdmin. From phpMyAdmin select the table, then "Operations" from the navigation tabs in the right frame above the table info; then "Repair Table" from the "Table maintenance" options at the bottom of the page.
Related posts:
- MySQL table is marked as crashed and should be repaired (Tuesday, August 2nd 2011)
- Show indexes for a table with MySQL (Wednesday, April 15th 2009)
- Optimize a table in MySQL from phpMyAdmin (Saturday, September 6th 2008)
- Running queries from the MySQL Command Line (Wednesday, April 16th 2008)
- phpMyAdmin (Wednesday, December 10th 2003)

Comments
blog comments powered by Disqus