Error migrating MySQL database


I’m trying to transfer over my phpBB database from my home server to Dreamhost.

I’ve used the mysql command in SSH to restore the database but immediately get the following error:

ERROR 1062 (23000) at line 23: Duplicate entry ‘2’ for key 1

The only thing I can think of is my config.php on my home server calls for a mysql database and on Dreamhost it lists mysql4.

Any suggestions? Thanks.


check to see if there is something set as Primary or Unique that has 2 of the same value for it.

We’re [color=#0000CC]DreamingOfYou[/color] :wink: Use PromoCode PerfectDream to save you the most?


I think my problem is that my backup is a phpbb backup (phpbb_db_backup.sql) and is almost nothing but INSERT commands so some of the tables already exist in the new database.

I tried running the restore with a 1.7MB gzipped file using the phpBB control panel and it says restore complete but nothing changes save for the old categories showing under Forum Management but no Forums, users, posts, etc.

A clean database won’t work, either.


I wish I had used phpMyAdmin to backup the database on my home server.


Try adding a -f on your command
mysql -f
from the manual
Continue even if the face of a SQL error.

I have found problems like that one on phpbb from time to time… adding the -f restores de DB, so you can work on it.

Fixing the repeating key is another matter (but I don’t think that stop you from using phpbb)



You’re my hero, man.


That did the trick! It’s always something simple!