#1062 duplicate content error when trying to upload database

Discussion in 'MySQL' started by pvijeh, Dec 5, 2013.

  1. #1
    I am trying to import a database using phpmyadmin but i get an error that says:

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

    anyone how to trouble shoot this puppy?
     
    pvijeh, Dec 5, 2013 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    You have a non-unique ID - maybe because you didn't use autoincrement on the old database, or you have content populating the current database which you're trying to add to. You can chose to drop the id-column (reassigning IDs), but this might be a problem if there is linked content in other tables. What you need to do is validate your data, or if possible, make sure you're importing into an empty table. If that's not possible, you can undo the unique-state of the ID column in the current database, but that might involve a lot of other trouble.
     
    PoPSiCLe, Dec 5, 2013 IP
  3. pvijeh

    pvijeh Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Hey thanks popsicle.

    I am definitely uploading to an empty database--- i deleted the whole thing right before upload.

    What is the best way to validate my data?
     
    pvijeh, Dec 5, 2013 IP
  4. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #4
    if you already removed everything => that means in the import sequence you have the issue with the duplicate entry => the insert is twice with the same id

    if the file isn't too large you could manually edit the insert lines with a text editor
     
    crivion, Dec 9, 2013 IP