I am trying to create a table in MySQL with two foreign keys, which reference the primary keys in 2 other tables, but I am getting an errno: 150 error and it will not create
In my case it was due to the fact that the field that was a foreign key field had a too long name, ie. foreign key (some_other_table_with_long_name_id)
. Try sth shorter. Error message is a bit misleading in that case.
Also, as @Jon mentioned earlier - field definitions have to be the same (watch out for unsigned
subtype).