Can't set foreign key relationship

Sandokan picture Sandokan · Jun 23, 2012 · Viewed 27.7k times · Source

I have some problem with MySQL Workbench in that I sometimes can't set foreign keys when creating tables. I say sometimes cause it's not always like this. The thing is when I enter a FK and choose a reference table I can't pick a referenced column. I can't click the check box and the drop down list is empty. I can't really figure out what the problem is cause I see no real difference from the FK's that are working. I have checked data type, name etc and they are correct. I'll provide a SS to elaborate. The green marked key (id_hem) is working ok and the red marks are those that don't.

Screenshot of WB

Answer

dwkd picture dwkd · Mar 3, 2015

I know this is old but the usual culprits are Non Null flag and Unsigned. Make sure you do match these on the foreign key column if the referenced column does have them enabled.