MySQL primary key conflict, unable to insert data

Source: Internet
Author: User

Database version: 5.6.16

Problem:
Development calls to say the warehouse can not order, the program inserted data tip: Inbound single xxxx1589762285 Confirmation failure: Duplicate entry ' 8388607 ' for key ' PRIMARY '

To view the database table structure:
Show CREATE TABLE table_name;
Table structure of the field as the primary key self-increment, should be no problem ah, carefully see the table structure ID type as follows:
' ID ' mediumint (8) Not NULL auto_increment

The field type is Mediumint, and the maximum supported value is 8388607, which determines the problem.

Modify the table structure of the ID field type, when modified must pay attention to add auto_increment, otherwise modified, the primary key self-increment to fail

ALTER TABLE table_name Modify ID bigint not NULL aotu_increment;

After the successful modification, contact development, let the warehouse to try again, no problem!

MySQL primary key conflict, unable to insert data

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.