View Single Post
  #1 (permalink)  
Old 07-16-07, 22:56
GongXi GongXi is offline
Registered User
 
Join Date: Jun 2004
Posts: 54
Lightbulb Correct way to backup mysql database with foreign Key

Hi all,

I am using MySql version 5.0 (Innodb). I would like to backup my database (include data) and restore to another server.
Every time i backup using mysql administrator, it will backup to a db.sql file and sort by tablename. I facing problem on restore my database as my table have foreign key.
example: i have table
1. member
2. state
3. city
4. country

and in the db.sql file, the backup sequence will be city, country, member and state.
But in my database, city have foreign key which link to state and country, so when i try to restore the database from the sql file, it faild during create table for city, cause state and country table not exist.

any better to do this?

very appreciate on your help.
Reply With Quote