[23000][1062] Duplicate entry ‘6‘ for key ‘PRIMARY‘

When inserting data in DataGrip, I tried to modify the field ID that has been set as the primary key and auto-increment, so this problem was caused:

[23000][1062] Duplicate entry '6' for key 'PRIMARY'

Translated meaning: Duplicate entry '6' for key 'PRIMARY'

reason:

Because the ID field is set to auto-increment the primary key, no value can be inserted. Then I just want to insert the value, what should I do?

 

 

Solution:

1. Click on the table and select Modify Table... (modify the table);

2. Uncheck Auto inc (self-increment) and Primary key (primary key) (that is, do not set auto-increment and primary key constraints).

After modifying the data in the table, get their two babies back (self-increment and primary key).

 

 

over. . .

Guess you like

Origin blog.csdn.net/weixin_62332711/article/details/129249551