Mysql Error
I was running an import script today taken from a mysqldump from another user, when I saw an error that looked like this:
ERROR 1005 (HY000) at line 123: Cant create table(errno: 150)
This is caused by a mysqldump or export process exporting tables in alphabetical order and not in the order in which they rely on one another. My tables had foreign keys which fail on import if the other table doesn’t exist when you create the table with the key. In this case I was only importing six or eight tables so I simply opened the script in a text editor and re-ordered the import blocks. On a bigger scale a more technical solution might be required!
SET FOREIGN_KEY_CHECKS=0;
Seems to be the solution.
Simon: Ah ha, I thought there was a thing to stop it from choking but I couldn’t find it – thanks for that :)