How to fix corrupted MyISAM tables

Source: Internet
Author: User

When we use PHPMyAdmin to browse the database, we sometimes find that the Collation items of some MyISAM tables are displayed as "in
Use ", which indicates that the table is damaged. Even if "in
The word "use" cannot indicate that the table is in good condition. It is necessary to be familiar with the check and repair methods.

Statement:

Use the check table statement as follows:

Check table tbl_name [, tbl_name]...
[Option]...
Option = {for upgrade | QUICK | FAST | MEDIUM | EXTENDED |
CHANGED}

The repair table uses the repair table statement as follows:

REPAIR [NO_WRITE_TO_BINLOG | LOCAL]
TABLE
Tbl_name [, tbl_name]...
[QUICK] [EXTENDED]
[USE_FRM]

Run the following command:

To check the repair table, run the myisamchk command:

Myisamchk [options] tbl_name
...

If no parameter is specified, the myisamchk Command performs the check action by default. If you want to repair a table, you can use the-r or-o parameters. You should first use-r for restoration. If not, use-o for restoration. In addition, FLUSH should be used before the fix.
Refresh the cache in TABLES, shut down the database server, or lock all TABLES to be repaired to ensure that no other write operations are performed during the restoration process.

Automatic repair:

In the mysqld section of the my. CNF configuration file, set the MyISAM-Recover parameter. when the service is started, the problematic table can be automatically repaired (depending on the data speed ):

[Mysqld]
MyISAM-recover
[=
Options]

The default, backup, force, and quick parameters can be set to backup, force, and force. You cannot set them to force separately. Otherwise, if the data file is lost, you will not be able to cry.

Try to use the myisamchk command to fix the problem. You cannot use the repair statement to fix the problem (slow). If not, refer to the following link.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.