After running this and successfully creating the database, tables and both the primary and foreign keys, when I reverse engineer my database it won't show the relationships between tables. I'm using a MacBook Air(2017) Mojave 10.14.6, no dark mode and I've tried changing relationships notation from craw's foot to the others but still no luck.

create database test_asdf;
use test_asdf;

create table Department
(id int not null unique auto_increment primary key,
name varchar(30));

create table Professor
(id int not null unique auto_increment primary key,
name varchar(30),
adress varchar(50),
department_id int,
section_id int,
foreign key (department_id) references Department(id));

Now the thing is when I run the following the connections show:

create database test_asdf8;
use test_asdf8;

create table table1
(id int not null unique auto_increment primary key,
name varchar(30),
table2_id int);

create table table2
(id int not null unique auto_increment primary key,
name varchar(30),
new_id int,
foreign key (new_id) references table1(id));

left from first code sample, right from second code sample

Could someone please point out what I'm doing wrong here?

  • i can't reproduce your behaviour with mysql workbench 8.0.22
    – nbk
    Oct 30, 2020 at 11:35

3 Answers 3


After further research it seems this is actually a bug.

Instead of directly reverse-engineering your database:

  • create a new model

  • save all your code in an .sql file

  • while in the model tab go to file-import-reverse engineer create script

  • check "place imported objects on diagram" and execute and there you go

Still unsure why the first above example won't work(with the straightforward approach) and the second one will but well... hope this helps.

  • didn't work for me. I had an sql and saved it to import but got this:Import of SQL script file '/Report.sql' has finished. 0 tables, 0 views and 0 stored procedures were imported in 0 schemas. May 5, 2022 at 18:51

I made the EER diagram by using reverse engineer tool and I also tried making the model by using the SQL script. I got the same result in both the cases. I have multiple cases of one to one relationships between various tables in my database but all the relationships shown in the EER diagram are one-to-many. Apparently, it is a bug.


You have to specifiy the database when you create the tables For example:

CREATE TABLE test_asdf.Professor

Without the specification, mysql throws the tables into mydb instead of the datebase you want it to.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.