Repairing crashed tables with the MySQL CLI
Use this procedure to repair MySQL tables from the command line:
- Log in to the server using SSH.
- From the command line, enter this command, replacing [username] with your username and without the brackets:
mysql -u [username] -p
- Enter your password.
- Again, without the brackets, enter the command:
use [databasename];
- Enter the command:
show tables;
- Unlike phpMyAdmin, there is no way to repair multiple tables with one command. Instead, you must issue one command per table:
- To check a table for errors, enter:
check table [yourtablename];
- To repair a table, enter:
repair table [yourtablename];
- Type quit to return to the command prompt.