There are 3 ways to fix MySQL database:
1. mysql Native SQL command: Repair
Execute the Repair TABLE SQL statement
Syntax: REPAIR TABLE tablename[,tablename1 ...] [Options]
Example: mysql> use database xxx;
mysql> Repair Table *;
2. Using MySQL's own client tool: Mysqlcheck (no need to stop MySQL service)
Specific information can be seen: Http://dev.mysql.com/doc/refman/5.1/zh/client-side-scripts.html#mysqlcheck
There are 3 ways to call Mysqlcheck:
Shell> Mysqlcheck [Options] db_name [tables]
Shell> mysqlcheck [Options]---database DB1 [DB2 DB3 ...]
Shell> Mysqlcheck [Options]--all--database
Example:
Automatically check and repair all tables for database xxxdatabase:
shell> Mysqlcheck--auto-repiar xxxdatabase-uroot-p
3. Using MySQL's own client tool: Myisamchk (need to stop MySQL service)
Less use, if you want to learn more, see the official MySQL documentation.
MySQL database table detection and Repair