There are generally 2 ways of repairing MySQL tables using the command line. First is to use “mysqlcheck“, the other is to use “myisamchk” (only for MyISAM). This is more for my own information.
This has been tested on Ubuntu 9.10 with MySQL 5
mysqlcheck
This is how you can check if your database tables are fine:
Change “Username” to your username and “Secret” to your password.
To repair them, use:
This requires of your MySQL daemon to be running. If it isn’t running use this to start:
myisamchk
If you have trouble running ‘mysqlcheck’, you can consider using ‘myisamchk’ instead if your tables are MyISAM. This command can be performed without MySQL daemon running. This fixes the data in your file system directly and this has saved me once.
Change “db_name” to your database name and “table_name” to the name of the table you wish to repair.