mysql 5 can't create foreign key error
Problem:
SQL Error (1005): Can't create table 'foo_database.#sql-64a_64' (errno: 150) Foreign key constraint is incorrectly formed
Solution: execute the SQL
SHOW ENGINE INNODB STATUS;
and you should find there further description of the error, for example:
(...)
------------------------
LATEST FOREIGN KEY ERROR
------------------------
100403 19:53:31 Error in foreign key constraint of table foo_database/#sql-64a_89:
foreign key (map_cordinates_id)
references map_cordinates(id)
on delete RESTRICT
on update RESTRICT:
Cannot resolve table name close to:
(id)
on delete RESTRICT
on update RESTRICT
(...)
so in this example I had a misspeled table name in the query.
Great tip! I used that status query and found out I needed an index on the dependent table. Now, I just need to figure out why importing csv files file when I include a column that has a datatype of float.