Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

importing table into database using phpmyadmin

Discussion in 'Database Discussions' started by broeder, Jul 15, 2012.

  1. broeder

    broeder Registered

    Jul 14, 2012
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Website Owner

    I need to restore a table. So I log into cpanel/phpmyadmin, choose table T and hit "import". Then I
    import the backup for table T.

    I get this:
    #1062 - Duplicate entry '1674' for key 1

    I am wondering if phpmyadmin replaces table T with the backup or adds both (which creates duplicates).

    Thing is when I import the whole backup database the same way, phpmyadmin dumps the old database
    and replaces it with the backup. So what did I miss ?

    Thanks if you can help..
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    MySQL itself tries to import entries without dropping the old data, which causes duplicates. This is why you'd need to import the table with the sql having had --add-drop-table flag for the creation. If it doesn't have that, it doesn't first drop the table to then import the new one.

    You could always just drop the table before trying to add it to get around that. You have a backup, it appears, so hopefully dropping the table won't cause any issues.

Share This Page