Howto: repair a mysql table

If you receive the following error message on your website, which means the table is crashed.

“Table “tablename” is marked as crashed and should be repaired”

The Mysql table consists of 3 files, .MYI, .MYD and .frm. The .MYI file contains the structure and results in the error message if something goes wrong with it. There are 3 ways to repair the table:

1)  Login to your cPanel, goto “Mysql Databases” option and click “Repair DB” in front of the databases.

2) Login to your server, goto mysql directory /var/lib/mysql and execute the command:              myisamchk -r dbname/tablename.MYI

3) Login to your server, goto Mysql prompt and execute the Mysql query:                                                         repair table tablename;

Anyone of the above 3 steps will repair the table and site will be back online.

This entry was posted on Sunday, October 4th, 2009 and is filed under Mysql & PostGres SQL. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.