Bug #12242 mysqlimport needs an option to ignore foreign key constraints
Submitted: 28 Jul 2005 15:51 Modified: 10 Aug 2007 13:16
Reporter: Paul Dlug Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.x OS:Any (any)
Assigned to: CPU Architecture:Any

[28 Jul 2005 15:51] Paul Dlug
Description:
If you are importing individual tables into InnoDB tables it would be exceedingly helpful to have an option on the command line for mysqlimport to ignore foreign key constraints during the import. Right now the only way to do this is to write a script to generate the SQL statements such as:

set FOREIGN_KEY_CHECKS = 0;
LOAD DATA INFILE ....
LOAD DATA INFILE ....
set FOREIGN_KEY_CHECKS = 1;

mysqlimport has options to lock tables and perform other actions, should be easy enough to add this one.

How to repeat:
Use mysqldump to dump out database structure as SQL and tables as comma separated, then import the tables, unless you order them correctly you'll get foreign key errors. Doing the SQL statements above gets everything imported correctly.

Suggested fix:
Add the describe command line option to mysqlimport.
[10 Aug 2007 13:16] Sveta Smirnova
Thank you for the reasonable feature request.

I'll set status of the report to "Duplicate", because there is verified Bug #19996 about very same problem which contains patch.