Menu

Foreign Key Constraints

Help
Anonymous
2011-03-10
2013-05-29
  • Anonymous

    Anonymous - 2011-03-10

    I'm using automysqlbackup to backup a a few InnoDB databases, and its working great.

    The one problem that I have is that foreign key constraints are being dumped in line with each table definition. This means that when it comes to importing the database from the backup, many constraints will fail (because the related table is not even in existance yet).

    The 'normal' way of getting around this is to only run all contraints after all tables have been created. However, I don't see an option for this in automysqlbackup.

    Any ideas on the best way around this?

     
  • Anonymous

    Anonymous - 2011-06-17

    In case anyone else reads this, the answer is to use the following statement at the top of your import file:

    SET FOREIGN_KEY_CHECKS=0;

     

Log in to post a comment.