[MySQL] Quick Solution to the "is marked as crashed and shoshould be retried red" Fault

Source: Internet
Author: User
The specific error is as follows:

Table '. \ tablename \ posts' is marked as crashed and shoshould be retried red

It indicates that the post table posts of the Forum is marked with an error and needs to be fixed. I remember a similar problem before, but I only need to click the repair button on phpMyAdmin to automatically fix it, but this time it was absolutely useless, so I quickly went online to find out why. Finally, the problem is solved. The solution is as follows:

Find the bin/myisamchk tool in the MySQL installation directory, and enter:

Myisamchk-c-r ../data/tablename/posts. myi

Then the myisamchk tool will help you restore the index of the data table. It seems that MySQL does not need to be restarted, and the problem is solved.

Problem Analysis:

1,
The cause of the error is that the index error is caused by frequent queries and updates to the dede_archives table. Because my page is not generated statically but is a dynamic page, I agree with this statement.
It is also said that the MySQL database is damaged for some reason, such: sudden Power outages on the database server and operations on the table's original files when providing services on the database table may result in
The MySQL database table is damaged and cannot read data. In short, the table is damaged due to some unpredictable problems.

2. Solutions.

There are three repair types when you try to fix a broken table. If you get an error message indicating that a temporary file cannot be created, delete the file indicated by the Information and try again-this is typically left behind by the last repair operation.
The three methods are as follows:
% Myisamchk -- recover -- quick/path/to/tblname
% Myisamchk -- recover/path/to/tblname
% Myisamchk -- safe-Recover/path/to/tblname

The first is the fastest, which is used to fix the most common problems, and the last is the slowest, which is used to fix problems that cannot be fixed by other methods.

Check and repair Mysql Data Files
If the above method cannot repair a damaged table, you can try the following two tips before giving up:
For example
If you suspect that the index file of the table (*. myi) an irreparable error occurs, or even this file is lost. You can use the data file (*. MYD) and Data Format File (*. FRM) re-emergence
. Create a copy of the data file (tblname. MYD. Restart your MySQL service and connect to the service. Run the following command to delete the table content:
Mysql> Delete from tblname;
In
When you delete the table content, a new index file is created. Log out and close the service again, and overwrite the new (empty) data file with the data file (tblname. MYD) You just saved.
Finally, use myisamchk to execute the standard repair (the second method above) and regenerate the index data based on the table data content and the table format file.

If your table's
The format file (tblname. FRM) is lost or an irreparable error occurs, but you know how to use the corresponding create
TABLE statement to regenerate the table. You can regenerate a new table. FRM file and your data file and index file (if there is a problem with the index file, use the above method to recreate a new one)
Start to use. Create a copy of the data and index file, and then delete the original file (delete all records related to the table in the data directory ).

Start MySQL and use the original create table file to create a new table. The new. frm file should work properly, but you 'd better execute the Standard fix (the second method above ).

 

 

To avoid accidental repair, we adopt a conservative approach. We know that an efficient MySQL management tool is phpMyAdmin, the management software contains the table check, analysis, repair, and optimization functions, which is safer and easier than the vague command lines provided on the Internet.

After using the checklist function, you can find the problem and then use the repair function to fix it. The feedback shows that each table is OK and you can perform optimization again, re-test the Website access and finally restore to normal. Avoid a disaster ......

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.