开发者

phpMyAdmin error #1062 - Duplicate entry '1' for key 1

I am not sure why I am getting this error #1062 - Duplicate entry '1' for key 1 cany any one help explain what it mean开发者_高级运维s. Thanks


More than likely your column is set to be Unique, and you're trying to input a row with an ID that already exists in your table.


You are probably trying to insert a record with the ID (or some other field) 1 set, while such a record already exists in the table. The field that is the primary key must have a unique value for each record.


I think you're trying to insert '1' to a unique key field that already has a '1' value


The problem is related with your file - you are trying to create a DB using a copy - at the top of your file you will find something like this:

CREATE DATABASE IF NOT EXISTS *THE_NAME_OF_YOUR_DB* DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci; USE *THE_NAME_OF_YOUR_DB*;

and I'm sure that you already have a DB with this name - IN THE SAME SERVER - please check.


You need to add primary key with the group in which one primary key must be unique value. e.g. if a table has 4 columns id, name, address, group_id where group_id has duplicate value , if I want to add group_id as primary then that should be in a group consist with id and group_id

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜