Mysql-error 1062 (23000)

Source: Internet
Author: User

1.1.1 phenomena

Perform the database operation, and the following error message appears:

ERROR 1062 (23000): Duplicate entry ' 0 ' for key ' PRIMARY '

1.1.2 cause

The problem table before the primary key is not set to automatically grow the column, and then the program needs to modify it to automatically grow the column, the result is inserted in the first data, the primary key is 0 , and then increase the data, it appears as the error, see the information is every time the data is added, the primary key is 0 , so this error is caused.

It is estimated that the primary key was not an autogrow column when it was created before the table, but was later modified to an autogrow column, but MYSQL there was a problem with engine recognition.

1.1.3 Solve

put this table Drop and then recreate it with the correct statement (including the primary key for the autogrow column).

Mysql-error 1062 (23000)

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.