Generating an EER Diagram in MySQL Workbench

Ishara Ilangasinghe
3 min readMar 6, 2019

--

We can easily create an EER Diagram from an existing database. This is known as Reverse Engineering in MySQL Workbench.

So before getting to know what is Reverse Engineering,

What is Forward Engineering?

We normally create a physical database from the ER diagram. First we design and then implement. This is called Forward Engineering.

Reverse Engineering?

There are times we need to do the other way around. Imagine we are given a massive database, where we need to understand the structure of it, then creating the ER diagram from existing database schema and studying the database would be easier. This is called reverse engineering.

In reverse engineering, we have working tools and we create a model from it which is converting a live database schema into a model.

What is a Model in MySQL Workbench?

Model is a top level object. It is a separate entity from the database.

  • Models contain
  • EER diagrams

Schemas that contain tables, views procedures and functions,

EER Diagrams

A Model can hold multiple ER diagrams. A diagram can contain elements from a schema but are independent from them, elements like tables, views etc. Each diagram can contain elements from different schemas too.

How to generate EER diagrams using Reverse Engineering?

Go to

MySQL Workbench/Database/Reverse Engineer/

If this is the first time you’re trying to generate an EER, let’s create a new connection first.

In the Reverse Engineer Database window, you can see the steps of reverse engineering in left pane.

Step 01: Connection Options

Create a new “Stored Connection‘ by selecting ‘Manage Stored Connetions’ from the drop down list. Now you can give the connection a name, give the username and password for your database connection.

Test the connection and click on “Close”, now a new db connection is added!

Click on the new “Stored Connection” created and click on “Next” to go to the next step.

Step 02 : Connect to DBMS

Step 03 : Select Schema

Step 04 : Retrieve Objects

Step 05 : Select Objects

We are given the privilege to choose which objects should appear in the EERD.

Click on the Show Filter button to use this feature.

Executing at the phase will complete the reverse engineering process, and will render the EERD.

Step 06 : Reverse Engineer

Click next to view Results.

Step 07 : Results

Now we can close the Rever Engineer Database window and finish the process.

You can simply export the EER diagram to a PNG, PDF, SVG or a PostScript file using MySQL workbench itself.

File/Export/Export as PNG

Voila! Now we have the whole database in an easy to digest EER Diagram :)

--

--

Ishara Ilangasinghe

Business Analyst | Speaker at Write the Docs Australia 2022 | Senior Technical Writer at WSO2 | Toastmaster | MBA | BEng