Friday, February 20, 2009

A caveat with MySQL and INNODB

While creating a new database using MySQL Workbench, I ran into a problem while running the "CREATE" script that it generated.
ERROR 1005: Can't create table (errno: 150)

There was no description of the error that I could use to fix it so I was stumped. So after doing a little searching, I came across this thread on the MySQL forums. Basically the problem was that the column for the referenced foreign key was not the same as the referencing column. It seems that a lot of people will forget the "Unsigned" property.

Another simple problem was
ERROR 1005: Can't create table (errno: 121)

This error stems from a duplicate foreign key name. Just be sure to name all of your foreign keys unique names.

No comments:

Post a Comment