Corrupted MyISAM table in MySQL

Source: Internet
Author: User

Even if the MyISAM table format is very reliable (all the changes that the SQL statement makes to the table are written before the statement returns), you can still get the corrupted table if any of the following events occur:

· The mysqld process was killed in the middle of writing.

· Unexpected computer shutdown occurs (for example, the computer is turned off).

· Hardware failure.

· You can use external programs (such as MYISAMCHK) on tables that are being modified by the server at the same time.

· Software flaws in MySQL or MyISAM code.

A typical symptom of a damaged table is as follows:

· When you select data from a table, you get the following error:

· Incorrect key file for table: ' ... '. Try to repair it

· The query cannot find rows in the table or return incomplete data.

You can use the Check Table statement statement to check the health of the MyISAM table and repair a corrupted MyISAM table with repair table. When the mysqld is not running, you can also use the MYISAMCHK command to check or repair a table.

If your table becomes frequently damaged, you should try to determine why this is the case. The most important thing to understand is whether the table becomes corrupted because of the server crash. You can find the most recent restarted mysqld message in the error log to validate this early. If there is such a message, it is possible that the table corruption is a result of the server's death. Otherwise, the damage may occur during normal operation. This is a flaw. You should try to create a repeatable test case that shows the problem.

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.