Import sql from old database to a new database

Permalink
Good day everyone,

I've got one issues here at the moment. I'm unable to import my old sql data to the new database. I'm trying to transfer my concrete5 site from my localhost to my client localhost.

Here's the error;

Error
SQL query:

-- -- Dumping data for table `areas` -- INSERT INTO `areas` (`arID`, `cID`, `arHandle`, `arOverrideCollectionPermissions`, `arInheritPermissionsFromAreaOnCID`, `arIsGlobal`) VALUES (1, 96, 'Header', 0, 0, 0), (2, 96, 'Column 1', 0, 0, 0), (3, 96, 'Column 2', 0, 0, 0), (4, 96, 'Column 3', 0, 0, 0), (5, 96, 'Column 4', 0, 0, 0), (6, 95, 'Primary', 0, 0, 0), (7, 95, 'Secondary 1', 0, 0, 0), (8, 95, 'Secondary 2', 0, 0, 0), (9, 95, 'Secondary 3', 0, 0, 0), (10, 95, 'Secondary 4', 0, 0, 0), (11, 95, 'Secondary 5', 0, 0, 0), (12, 1, 'Header Nav', 0, 0, 0), (13, 1, 'Header', 0, 0, 0), (14, 1, 'Sidebar', 0, 0, 0), (15, 1, 'Main', 0, 0, 0), (16, 1, 'Site Logo', 0, 0, 1), (17, 112, 'Main', 0, 0, 0), (18, 1, 'Footerbox 1', 0, 0, 1), (19, 113, 'Main', 0, 0, 0), (20, 1, 'Main Content', 0, 0, 0), (21, 1, 'col_one', 0, 0, 0), (22, 1, 'Main Content 2', 0, 0, 0), (23, 1, 'News Content 1', 0, 0, 0), (24, 1, 'News Content 2', 0, 0, 0), (25, 127, 'News Content 1', 0, 0, 0), (26, 127, 'News Content 2', [...]

MySQL said: Documentation

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

Thanks!

yusranysf
View Replies: View Best Answer
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
You haven't mentioned the process you have followed to export your database. Do you use phpmyadmin prompt to export it?

Anyway check the remote destination database whether it is fully empty or not. I think it has some data.

Rony
yusranysf replied on at Permalink Reply
yusranysf
Thanks for the prompt reply.

Yes, I'm using WAMP phpmyadmin. I exported my sql database using "Quick - display only the minimal options". When I try to import the sql database into my client phpmyadmin new database, the errors above occured. Need your side help on this.

Appreciate your help. Thank you!
weyboat replied on at Permalink Reply
weyboat
Instead of using your wamp backup file try downloading a backup file from concrete database backup, and import that file instead..
Your wamp file will probably be trying to create a complete database whilst the concrete one will only be populating an existing blank database with all the necessary tables..
yusranysf replied on at Permalink Reply
yusranysf
Thanks for your suggestion! Appreciated your prompt reply too!
goldhat replied on at Permalink Best Answer Reply
Pretty sure Rony already gave you the correct answer. That error can only happen if the new database already has data in it. Even if it was empty when you first started after your attempts the database has data in it. You have to perform a DROP on all tables. Look under STRUCTURE in PHPMyAdmin and remove all tables before doing your import.
yusranysf replied on at Permalink Reply
yusranysf
Thanks goldhat. It works! Problem solved.