Fixing MySQL #1062 Error

by 5 replies
6
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
#programming ##1062 #error #fixing #mysql
  • Banned
    [DELETED]
  • Reset identity to 154
    it will fix it

    Cheers
  • 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 !
    • [1] reply
    • no need to delete. Changing it to 154 will resolve it :/
      • [1] reply
  • 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.

Next Topics on Trending Feed