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;



No comment yet.

A remark, a suggestion? Do not hesitate to express yourself below. Just be courteous and polite, please.

If this field is left blank, you will appear as Anonymous.