BUG: sql dump import Foreign key constraint is incorrectly formed
kfo2010 opened this issue · 1 comments
If doing a sql dump, it fails on re-import with this error.
ERROR 1005 (HY000) at line 3: Can't create table aronode.accounts (errno: 150 "Foreign key constraint is incorrectly formed")
Process is...
- stop nginx/php
- delete database
- recreate database
- import dump
- restart services
- refresh git, delete sanity lock, and load site to refresh sync
Fix appears to be SET foreign_key_checks=0;
before import then set back to 1 after import.
I just appended commands to beginning and end of sql dump.
Something like so...
dump.sql
SET FOREIGN_KEY_CHECKS = 0;
..... SQL DUMP ....
SET FOREIGN_KEY_CHECKS = 1;
it defaults to 1 on basic mysql install so others have and will run ito this problem. Any ideas on how to fix/prevent this issue?
This is actually the default (skipping foreign key checks) afaik, but the --compact
option seems to remove this.
I've now made another dump with --compact
disabled, so could you test this?