I am trying to create a foreign key between 2 tables. I am using MySQL Workbench but every time I create the foreign key relationship, it just dissappears after clicking "apply"... Initially I thought it was Workbench so I tried the legacy Query Browser - but it does the exact same thing... It gives no errors or anything, it just simply removes the foreign key after executing the code... I am using the MySQL that comes built into wamp.


Try the mysql command line which will tell you about your error.
Check that the fields used as foreign keys have indexes.
Check that you're using InnoDb as storage engine for all tables.