MySQL dump import -> Error 1217

Contributor Icon Contributed by dionak Date Icon December 20, 2004  
Tag Icon Tagged: MySQL

When using innodb tables and foreign key constraints, importing a mysqldump can sometimes generate foreign key errors.


Add to the beginning of the dump file: SET FOREIGN_KEY_CHECKS=0;

Add to the end of the dump file: SET FOREIGN_KEY_CHECKS=1;

This disables foreign key checks for the mysqldump import session only, allowing the data to be imported without the error being generated.

Previous recipe | Next recipe |
 
  • Anonymous
    i had a table that did not want ot be deleted.
    i used this to make it delete, my syntax was (just pailn sql)

    SET FOREIGN_KEY_CHECKS=0;
    DROP TABLE draairegel;
    SET FOREIGN_KEY_CHECKS=1;


    and it was gone,

    thanx for the tip!
blog comments powered by Disqus