How to Check MySQL Database for Corruption

MySQL database corruption usually occurs as a result of a hardware (especially disk-based) failure, or when a disk becomes full. Typical symptoms are failure on login, with this message displayed:

Session Replace: Table ‘./dbname/table_data’ is marked as crashed and should be repaired

The problem can be repaired using the mysqlcheck command:

$ mysqlcheck -uroot -p –auto-repair dbname

Please note that MySQL database server must be running when executing the mysqlcheck command. If there are problems with the tables, the auto-repair option will fix them automatically. The repair process can take a long time to complete.  Re-run the command again to double-check that all tables are OK.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s