Programming

MySQL: "ERROR 1005 (HY000): Can't create table ... (errno: 150)"

There can be a few reasons for this very helpful message. In my case, MySQL's default engine on the production server was MyISAM, while being InnoDB on the development server.

MyISAM does not handle foreign keys, thus the above error. The simple fix is to switch engines:

mysql> ALTER TABLE tableName ENGINE = InnoDB;

Back