If you run this same problem with HeidiSQL. The error message you will receive will be very cryptic.
Your problem will end up as the foreign key column and the referencing column will not be of the same length or type.
The foreign key column will be SMALLINT(5) UNSIGNED and the referenced column will be INT(10) UNSIGNED.
Once You'll make both of them the same exact type, the foreign key creation will work perfectly.