Ask my brother if my mysql status is healthy.

There are two ways to check whether mysql is healthy:

One way is to use mysql's checklist and sql statement to repair the table, and the other way is to use multiple myisamchk and isamchk data detection and recovery tools provided by MySQL. The former is relatively simple to use. Recommended use.

1. Checklist and repair list

Log in to mysql terminal:

Mysql -uxxxxx -p database name

Checklist tabTest

If the result shows that the status is normal, it does not need to be repaired. If there is an error, you can use:

Repair table tabTest

Repair, after repair, you can use the checklist command to check. The check/repair function can also be used in the new version of phpMyAdmin.

2. Misamak, Misamak

MYISAMchk is suitable for Myisam type data tables, while isamchk is suitable for ISAM type data tables. The main parameters of these two commands are the same. Usually, the new system uses MYISAM as the default data table type. Take myisamchk as an example to illustrate here. When you find a problem with the data table, you can use:

Myisamchk table name. MYI

To detect and repair, you can use:

The table name of myisamchk- MYI

For detailed parameter description of myisamchk, please refer to its help. It should be noted that MySQL server must not access this data table during modification, and it is best to shut down MySQL server during testing, just in case.

In addition, before starting the MySQL server, you can put the following command in rc.local:

[-x/tmp/MySQL . sock]& amp; & amp/pathtochk/myisamchk-of/DATA _ DIR/*/*。 MYI

Where /tmp/mysql.sock is the location of the sock file that mysql listens to, and it should be /var/lib/MySQL/Sock for users who install with RPM, and /tmp/mysql.sock for users who install with source code, which can be changed according to their own actual situation, while pathtochk is the location of myisamchk, and DATA_DIR is the location where your MySQL database is stored.

It should be noted that if you want to put this command into your rc.local, you must ensure that the MySQL server cannot be started when this command is executed! Detect and repair all databases (tables)