mysql table is marked crashed,  but status is still ‘OK’

The Problem

We got an error when attempting to dump and backup the mysql database.  It would get an error saying the table was crashed and needed to be retored.

mysqldump: Error 1194: Table 'help_topic' is marked as crashed and should be repaired when dumping table `help_topic` at row: 507

This most likely could apply to any table.

The analysis

We just run a check against the database and it shows a warning

#mysqlcheck -c mysql help_topic
warning : Size of datafile is: 484552 Should be: 482440
status : OK 

So it seems odd that we have a problem if it says the status is okay,  but the data file size issue is the problem

The solution

Even though it says it is okay,  it has to be repaired,   so we run

#mysqlcheck -r mysql help_topic

Voila!  No more error.


(This fix can be used on any table)