Answers for "(errno: 150 "foreign key constraint is incorrectly formed")"

1

(errno: 150 "foreign key constraint is incorrectly formed")

I ran into this same problem with HeidiSQL. The error you receive is very cryptic. My problem ended up being that the foreign key column and the referencing column were not of the same type or length.

The foreign key column was SMALLINT(5) UNSIGNED and the referenced column was INT(10) UNSIGNED. Once I made them both the same exact type, the foreign key creation worked perfectly.
Posted by: Guest on March-12-2021

Code answers related to "(errno: 150 "foreign key constraint is incorrectly formed")"

Browse Popular Code Answers by Language