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.