MySQL errno:1062 Bug fix

Source: Internet
Author: User

The site suddenly appears with the following error:

MySQL Error: Duplicate entry ' 1 ' for key ' views '
MySQL Errno: 1062
Message: Duplicate entry ' 1 ' for key ' views '

I use

Myisamchk Cdb_posts.myi-r

Fixed the table, but the contents of the table views were emptied, fortunately, my side is the article Access scale, not very important, before also made a backup!

The following two repair tables are recommended:

REPAIR table ' table_name ' repair form
OPTIMIZE table ' table_name ' optimization tables

In most cases, you can also use the command OPTIMIZE tables to optimize and fix the table, if it is not the case or less with myisamchk, although myisamchk fast or reliable (in the case of a real fatal error).

Mainly optimize table is easier to use and you do not have to care about emptying the table.

If you delete most of a table or if you change a table with a variable length (a table with a varchar, blob, or text column), you should use Optimze table. Deleted records are maintained in a linked table and subsequent insert operations use the old record location again. You can use optimize table to reclaim unused space.

OPTIMIZE table works by making a temporary copy of the original table. The old table is copied to the new table (no idle rows), then the original table is deleted and a new one is renamed. Doing so makes all updates automatically turn to the new table without any failed updates. When optimize table is executing, the original table can be read by another customer. Updates and writes to the table are deferred until the new table is ready.

MySQL errno:1062 Bug fix

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.