Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 5th Dec 2013, 05:18 PM   #1
HyperActive Warrior
Registered Member
 
Join Date: 2012
Posts: 189
Thanks: 66
Thanked 14 Times in 14 Posts
Blog Entries: 1
Default
Fixing MySQL #1062 Error
Share on: 
fb share twitter share gplus share more share

Warriors-

I am trying to copy a development copy of my site to my production server- however when i try to upload my SQL database I get the following error

#1062 - Duplicate entry '153' for key 'id'


has anyone encountered this before?

Im not sure where else to turn

thanks

Peter
pvijeh is offline  
Unread 6th Dec 2013, 08:58 PM   #2
9TO5Host.com
 
Join Date: 2012
Posts: 51
Thanks: 18
Thanked 9 Times in 8 Posts
Default
Re: Fixing MySQL #1062 Error
Share on: 
fb share twitter share gplus share more share

Reset identity to 154
it will fix it

Cheers
Immu is offline  
Unread 8th Dec 2013, 08:16 AM   #3
GCP AWS Cloud Developer
 
Join Date: 2007
Location: Chennai, India.
Posts: 40
Thanks: 0
Thanked 1 Time in 1 Post
Default
Re: Fixing MySQL #1062 Error
Share on: 
fb share twitter share gplus share more share

Originally Posted by pvijeh View Post

Warriors-

I am trying to copy a development copy of my site to my production server- however when i try to upload my SQL database I get the following error

#1062 - Duplicate entry '153' for key 'id'


has anyone encountered this before?

Im not sure where else to turn

thanks

Peter
Try emptying your current database fully before starting the dbimport once again. Do make a complete backup of your existing database before even thinking about deleting it though !

Chris, Developer, Chrisranjana.com,
AWS Developer GCP Engineer Python NodeJS Programmer
chrisranjana.com is offline  
Unread 9th Dec 2013, 04:44 AM   #4
Warrior Member
 
tanmay92's Avatar
 
Join Date: 2013
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default
Re: Fixing MySQL #1062 Error
Share on: 
fb share twitter share gplus share more share

no need to delete. Changing it to 154 will resolve it :/
tanmay92 is offline  
Unread 11th Dec 2013, 09:32 PM   #5
Active Warrior
War Room Member
 
Join Date: 2013
Posts: 48
Thanks: 0
Thanked 9 Times in 9 Posts
Default
Re: Fixing MySQL #1062 Error
Share on: 
fb share twitter share gplus share more share

Originally Posted by tanmay92 View Post

no need to delete. Changing it to 154 will resolve it :/
not if theres something with id = 154 already they will get the error again for 154 instead of 153

so you would need to backup, delete old data, the do the dbimport
softwarewarden is offline  
Unread 12th Dec 2013, 12:51 AM   #6
IM Rocks!
War Room Member
 
shahriyar's Avatar
 
Join Date: 2010
Location: USA
Posts: 501
Thanks: 52
Thanked 65 Times in 60 Posts
Arrow
Re: Fixing MySQL #1062 Error
Share on: 
fb share twitter share gplus share more share

Originally Posted by pvijeh View Post

Warriors-

I am trying to copy a development copy of my site to my production server- however when i try to upload my SQL database I get the following error

#1062 - Duplicate entry '153' for key 'id'


has anyone encountered this before?

Im not sure where else to turn

thanks

Peter
The "id" field is your primary key (I believe) and its value is always unique (no dupe) to identify a record uniquely. The error is saying that there is a row with id "153" already and you are trying to add another row with id 153, hence the error.

Is possible that the table already has a row with id 153? in that case you need update your source SQL (remove conflicting ids, replace them with unique values) before importing it to the new DB. Or clear the new table and try importing the SQL again.

shahriyar is offline  
Closed Thread


Bookmarks

Tags
#1062, error, fixing, mysql


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 07:09 AM.