General process of MySQL fault detection and correction (2) check the database table
Myisamchk and isamchk provide table check methods that differ in the extent to which a thorough checklist is performed.
Standard method checklist
Generally, the standard method is enough. Check the table using a standard method. you can directly call the table without any options, or use either the-s or -- silent options:
Myisamchk tbl_name isamchk tbl_name
This can identify the 99.99% of all errors. What it cannot find is that it only involves corruption of data files (which is not common ).
Complete and thorough data check
To perform the expansion check, use the -- extend-check or-e option, which checks the data:
Myisamchk-e tbl_name isamchk-e tbl_name
It performs a completely thorough data check (-e means "extension check "). It performs a read check on each row for each key to verify that they actually point to the correct row. This can take a long time on a large table with many keys. Myisamchk usually stops after it discovers the first error. If you want more information, you can add the -- verbose (-v) option. This causes the myisamchk or isamchk to continue up to 20 errors. In general use, a simple standard check (without parameters other than the table name) is enough.
Moderate check
Specify options -- medium-check or-m
Myisamchk-m tbl_name
A moderate check is not as fast as a full extension check. It is of little significance and rarely used.
If no error is reported for the -- extend-check, the table is intact. If you still feel that the table is faulty, the reason must be somewhere else. Re-check and queries that appear to be problematic to verify that the query is correctly written. If you think the problem may be caused by the MySQL server, you should organize a fault report or upgrade it to a new version.
Possible check options:
1.-I or-information: print statistical information, for example:
Myisamchk-e-I tbl_name
Like the previous command, the-I option tells myisamchk to print some statistics.
2.-C, -- check-only-changed
Only the table modified after the last check is checked