MySQL Error 1064 when adding foreign key with MySQL Workbench

前端 未结 7 1694
野性不改
野性不改 2021-01-04 10:48

So I have an error, when I want to add a foreign key. I added the foreign key in MySQL Workbench with an EER Diagram Model. The lines workbench tries to add are:`

         


        
相关标签:
7条回答
  • 2021-01-04 11:12

    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.

    0 讨论(0)
  • 2021-01-04 11:18

    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.

    0 讨论(0)
  • 2021-01-04 11:18

    Remove the VISIBLE keyword and run the code if its below mysql 5.7

    0 讨论(0)
  • 2021-01-04 11:20

    i was using mysql version 5.5.62 .

    commenting of the line INDEX 'fk_CUSTOMER_BARBER_idx' ('BARBER_ID' ASC) VISIBLE, did worked for me.

    0 讨论(0)
  • 2021-01-04 11:24

    it can be for the current version of mysql against the default version workbench:

    Change default targe version mysql in workbench:

    references -> Modeling -> MySQL -> Default Target MySQL Version

    0 讨论(0)
  • 2021-01-04 11:28

    Check Your MySQL version and update it in:

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

    My MySQL version is 5.7.21.

    0 讨论(0)
提交回复
热议问题