Tag: rds

  • Repairing damaged or crashed MySQL tables

    Always remember, regular backups of your databases are best practice, in the event the below fail, backups may be the only method you have to restore a working table or database.

    Damaged or crashed MySQL tables due to an unsafe server shut downs, disk space limits or general MySQL failures? You will normally see something along the lines of “marked as crashed and should be repaired when using LOCK TABLES” within your MySQL log files.

    MySQL has a number of tools to try and repair crashed / damaged tables. Log into your server as root and run the following commands. Replacing “/var/lib/mysql/” with the location of your DB files.

    Check what tables need repaired:

    myisamchk –check /var/lib/mysql/*/*.MYI

    Try a safe recovery:

    myisamchk –safe-recover /var/lib/mysql/*/*.MYI

    Try a normal recovery (if safe recovery fails):

    myisamchk –recover /var/lib/mysql/*/*.MYI

    Try a force recovery (as a final last step):

    myisamchk –safe-recover –extend-check –force /var/lib/mysql/*/*.MYI

    or:

    myisamchk –recover –extend-check –force /var/lib/mysql/*/*.MYI