Problem importing database of Wordpress blog

Discussion in 'MySQL' started by Tom Alex, Apr 4, 2009.

  1. #1
    I'm having a problem importing the database of a blog. When I try and do it, it will import some of the database (the comments) but then it comes up with this error:

    SQL query:
    
    --
    -- Dumping data for table `mostAccessed`
    --
    INSERT INTO `mostAccessed` ( `postnumber` , `cntaccess` )
    VALUES ( 5, 1893 ) , ( 6, 1572 ) , ( 7, 2469 ) , ( 8, 2610 ) , ( 4, 1959 ) , ( 3, 1173 ) , ( 2, 108 ) , ( 9, 5627 ) , ( 10, 1399 ) , ( 11, 1053 ) , ( 12, 503 ) ;
    
    MySQL said: Documentation
    #1062 - Duplicate entry '5' for key 1 
    
    Code (markup):
    I don't know much about databases so am a little confused what the problem may be. Any ideas?
     
    Tom Alex, Apr 4, 2009 IP
  2. qazu

    qazu Well-Known Member

    Messages:
    1,834
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Looks like you're trying to import it into an existing database so you're getting duplicate primary (id) keys. Databases use primary keys for referencing with related tables, for example to maintain the relationship between a post and it's comments. The primary keys must be unique or you'll get different data relating to the same post or the same data relating to different posts.
     
    qazu, Apr 5, 2009 IP
  3. nirajkum

    nirajkum Active Member

    Messages:
    815
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    your table should be clean while importing the new entry .... or better delete all the entry of the primary key .. its auto incrementing ...
     
    nirajkum, Apr 7, 2009 IP