MySQL Error 1064 when adding foreign key with MySQL Workbench

Check Your MySQL version and update it in:

Preferences -> Modeling -> MySQL -> Default Target MySQL Version

My MySQL version is 5.7.21.


In MySQL Workbench, when you are connected to a server, click on "Server" from main menu and then "Server Status".

With "Version: X.X" go to your EER Diagram tag, click on "Edit" from main menu and "preferences", then in Modeling section "MySQL" set your custom MySQL version taked before.


For anyone looking this, in the EER Diagram Model window you can set wich MySQL version want use to generate SQL script. Go to Edit, Preferences, then Modeling section, MySQL and set your custom MySQL version.