Incorrectkeyfilefortable: trytorepolicrit in mysql

Source: Internet
Author: User
In windows, mysql may encounter the prompt "Incorrectkeyfilefortable: trytoreeffecrit". Common Causes of mysql table destruction: 1. Data File Corruption caused by sudden server power failure. 2. Force Shutdown without shutting down the mysql service first.

In windows, you may encounter the prompt "Incorrect key file for table: Try to repair it" in mysql. The common causes of mysql table destruction are as follows: 1. Data file damage caused by sudden server power failure. 2. Force Shutdown without shutting down the mysql service first.

Symptoms of damage

Typical symptoms of a damaged table are 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 shoshould be retried red.
4. failed to open the table: Can't open file: '×××. myi' (errno: 145 ).


Repair of MySQL table corruption

To fix the MyISAM table, follow these steps:

1. Use reapair table or myisamchk to fix the issue.
After repairing the table with phpmyadmin, the system prompts "marked as crashed and last (automatic) repair failed ". After checking relevant information, I learned that myisamchk can be used to repair the table.
Myisamchk.exeis in the mysqlbindirectory. If this directory does not exist, download the attachment myisamchk.rar.

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

The Code is as follows:

Myisamchk/usr/local/mysql/var/dbName/tblName
Myisamchk/usr/local/mysql/var/dbName/tblName. MYI


You can run the preceding two commands to check the specified table. To check all tables in the database, you can use wildcards.

Repair procedure:

1) Stop the mysql service before the fix.
2) Open the command line and enter the/bin directory of mysql.
3) execute myisamchk -- the path of the recover database/*. MYI. Note: Do not follow the prompt; No.

However, the Myisamchk tool is not omnipotent. This tool is useless for some extreme damage, such as damage to the table description file. For this reason, the database administrator still needs the best routine backup of the database.

Use phpmyadmin to modify

Find the database of the problematic table in phpmyadmin, then find the problematic table, and click repair table below to solve the problem quickly.

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.