MyBB Community Forums

Full Version: Importing backup data.sql file outputs error "Duplicate entry '0' for key 'PRIMARY' "
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I'm moving my website to another host and I've came up with a big problem I've been having all day. Googling does not return any answers and it's really frustrating me.

I'm trying to import the data.sql file I've exported from MyBB's admin panel using PHPMyAdmin.

I keep getting the following error message:



SQL query:

INSERT INTO mybb_datacache(  `title` ,  `cache` ) 
VALUES (

'internal_settings',  'a:1:{s:14:\"encryption_key\";s:32:\"rrvohvVATtOauucNTmEXAmvNvbw9ujvb\";}'
);

MySQL said: 

#1062 - Duplicate entry 'internal_settings' for key 'PRIMARY' 

 

When importing to various tables. I'm really hoping for some help here. What can I do to fix this issue?
(2013-02-04, 09:54 PM)kawohi Wrote: [ -> ]Hi, I'm moving my website to another host and I've came up with a big problem I've been having all day. Googling does not return any answers and it's really frustrating me.

I'm trying to import the data.sql file I've exported from MyBB's admin panel using PHPMyAdmin.

I keep getting the following error message:

Duplicate entry '0' for key 'PRIMARY'  

When importing to various tables. I'm really hoping for some help here. What can I do to fix this issue?
can you give more info ? normally if you have a blank database and have access to it you can import with no problem ... is there a problem with the backups header ? To check this out open the import file & check that the header is correct... it may be pointing to the database of your old host
(2013-02-04, 11:05 PM)JimR Wrote: [ -> ]
(2013-02-04, 09:54 PM)kawohi Wrote: [ -> ]Hi, I'm moving my website to another host and I've came up with a big problem I've been having all day. Googling does not return any answers and it's really frustrating me.

I'm trying to import the data.sql file I've exported from MyBB's admin panel using PHPMyAdmin.

I keep getting the following error message:

Duplicate entry '0' for key 'PRIMARY'  

When importing to various tables. I'm really hoping for some help here. What can I do to fix this issue?
can you give more info ? normally if you have a blank database and have access to it you can import with no problem ... is there a problem with the backups header ? To check this out open the import file & check that the header is correct... it may be pointing to the database of your old host

I'm not sure what more information I can give. I exported the structure and data backup using MyBB. I then try to go to the new host PHPMyAdmin and import both files. The structure.sql file worked and ran successfully, but not the data.sql file, which is giving me the error I mentioned.

I just edited the post with the whole error.
(2013-02-04, 11:14 PM)kawohi Wrote: [ -> ]
(2013-02-04, 11:05 PM)JimR Wrote: [ -> ]
(2013-02-04, 09:54 PM)kawohi Wrote: [ -> ]Hi, I'm moving my website to another host and I've came up with a big problem I've been having all day. Googling does not return any answers and it's really frustrating me.

I'm trying to import the data.sql file I've exported from MyBB's admin panel using PHPMyAdmin.

I keep getting the following error message:

Duplicate entry '0' for key 'PRIMARY'  

When importing to various tables. I'm really hoping for some help here. What can I do to fix this issue?
can you give more info ? normally if you have a blank database and have access to it you can import with no problem ... is there a problem with the backups header ? To check this out open the import file & check that the header is correct... it may be pointing to the database of your old host

I'm not sure what more information I can give. I exported the structure and data backup using MyBB. I then try to go to the new host PHPMyAdmin and import both files. The structure.sql file worked and ran successfully, but not the data.sql file, which is giving me the error I mentioned.

I just edited the post with the whole error.

I guess you are importing the same data twice ? look at the first import file then again at the second ... you may find that both imports alter the same tables but it is difficult to work it out with out both import files
You can PM me to view the SQL file....
(2013-02-05, 12:31 AM)kawohi Wrote: [ -> ]You can PM me to view the SQL file....

done
There's nothing to figure out. It simply means your datacache table already has an entry called "internal_settings". A primary key has to be unique. Assuming you do not care about the data that's there and just want to import your old database, either truncate or drop all the existing tables in that schema, then try importing your sql again.