mysql error 1062

Duplicate entry ‘1’ for key ‘PRIMARY’

Error reason: primary key conflict, primary key value is unique
solution: the value of ‘primary’ primary key cannot be the same

Example:

1. View the table structure

2. View data

3. Add data, add id = 1, and an error will be reported, because ID is the primary key with uniqueness

Solution: if the value of ID is modified, the addition is successful


Read More: