MySQL incorrect key file for table:try to repair it

Source: Internet
Author: User
Tags phpmyadmin

Symptoms of damage

A typical symptom of a damaged table is as follows:
1. When selecting data from a table, you get the following error: Incorrect key file for table: ' ... '. Try to repair it
2. The query cannot find rows in the table or return incomplete data.
3. Error:table ' P ' is marked as crashed and should to be repaired.
4, open the table failed: Can ' t open file: ' xxx. Myi ' (errno:145).


MySQL Table Damage Repair

The MyISAM table can be repaired using the following steps:

1, use Reapair table or Myisamchk to repair.
Use phpMyAdmin to repair the table with sadness, prompting "marked as crashed and last (automatic) repair failed". After checking a related information, I learned that using the Myisamchk tool can repair the table.
Myisamchk.exe in the Mysqlbin directory, if the directory is not available please download the attached Myisamchk.rar of this article.

To check for errors in a table, you only need to run Myisamchk (in the MySQL bin directory) and provide the location and table name of the file, or the index file name of the table:

The code is as follows Copy Code

Myisamchk/usr/local/mysql/var/dbname/tblname
Myisamchk/usr/local/mysql/var/dbname/tblname.myi


All two of the above commands can perform a check on the specified table. To check all tables in the database, you can use the wildcard character

Repair steps:

1 Stop the MySQL service before fixing it.
2 Open the command line, and then go to the MySQL/bin directory.
3 Execute MYISAMCHK--recover database path/*.   Myi. Note: Do not follow the prompts behind;

However, it should be noted that the MYISAMCHK tools are not omnipotent. The tool is useless for some extreme damage, such as a corrupted form description file. This database administrator still needs the best database day-to-day backup work

Using phpMyAdmin to modify

Find the database of the problematic table in phpMyAdmin, then go to the table where the problem is found, and then click on the repair table below to quickly implement the problem.

Related Article

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.