MySQL: Duplicate entry 'config_id' for key 1

Discussion in 'MySQL' started by richu, Aug 2, 2008.

  1. #1
    Hello,

    I am fed up with this error message.
    I am trying to export the database from one server and then import to another server.
    what is the problem actually?

    How to correct it?

    Why i am getting this error :-

    MySQL: Duplicate entry 'config_id' for key 1

    Please help
     
    richu, Aug 2, 2008 IP
  2. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It means you are trying to insert two rows with the same config_id and config_id is a primary key so the id for each row must be different. Try removing the primary key
     
    garrettheel, Aug 2, 2008 IP
  3. richu

    richu Peon

    Messages:
    460
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    How to remove the primary key?
    Should i remove while exporting ?or while restoring ?
     
    richu, Aug 2, 2008 IP
  4. david_t

    david_t Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #4
    This is software you haven't created right? Then you probably don't want to remove the primary key. What you need to do is checking that the value doesn't exists in both of the databases. (Since primary keys are required to be unique.)
     
    david_t, Aug 3, 2008 IP
  5. garrettheel

    garrettheel Peon

    Messages:
    341
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Well, I didn't mean to remove the primary key permanently. I just meant to remove it to see if it would import while the key was gone, then we definitely know that's the issue.
     
    garrettheel, Aug 3, 2008 IP
  6. david_t

    david_t Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #6
    Ah, that is true.
     
    david_t, Aug 3, 2008 IP