Restoring mysql dump file

We have a complex database involving foreign keys and we want to restore such database from dump file. If we try to run mysql dump file directly then there might be some errors related to foreign key constrain. The cause for such errors is that a table restore is called while it has foreign key dependency to some other table which has not been restored yet. To ignore such errors, we need to put one simple sql line (SET FOREIGN_KEY_CHECKS=0;) in the beginning of sql dump file. After adding “SET FOREIGN_KEY_CHECKS=0;” remember to add the “SET FOREIGN_KEY_CHECKS=1;” at the end of the dump file.

Related Post

Changing root user password in mysql
Backup of mysql database
Connecting to mysql database
Installing mysql in linux
Setting up j2ee developer environment in ubuntu/linux

Comments

Leave a Reply