How do I repair a mysql database table via command line?



To repair a mySQL database via the command line you will need to ssh into your server as the root user and enter into the mySQL command line interface by typing my "mysql". This will give you the following prompt.

mysql>

Once you are at a mySQL command prompt you will need to type the following. The first USE statement selects the database you wish to use and the second REPAIR TABLE statement repairs the table(s).

mysql> USE your_database;
Database changed

 

mysql> REPAIR TABLE `table1` , `table2` , `table3` , `table4`;