lunedì 13 settembre 2010

Repair MySQL tables with error "Incorrect file format"

If you have a MySQL database that has a table with a damaged index, you may get an error, such as "Incorrect file format 'TABLENAME'", with "TABLENAME" being the name of the table with the damaged index.

You can fix this problem using your favourite administrative tool for MySQL.
This is what you have to do:

  1. Log in to your db
  2. Open a query editor
  3. Write a statement like this
    repair table "TABLENAME" use_frm;
    
  4. Execute the query

This should solve the issue with the table by forcing the index to be rebuilt from the database file.