DEV Community

Cover image for How to access the ERD (Entity-Relationship Diagram) of your database schema in MySQL Workbench
Massy
Massy

Posted on

How to access the ERD (Entity-Relationship Diagram) of your database schema in MySQL Workbench

As a data analysis student, you may know what an Entity Relationship Diagram is and how it helps you quickly get familiar with a database schema and its main properties like tables, table relationships as well as table columns (and their respective data types)

But because you've always been practising and answering the SQL questions using an online interactive SQL instance, you have only been able to view an ERD because it has always been provided to you as an image. This means you've never had to generate a physical entity relationship diagram in a Database Management System like MySQL.

Yet, in the real workplace setting, or when you start answering SQL questions using a DBMS, you need to know how you can view or access the ERD of the database schema you intend to query from.

Below are steps you can follow to view the ERD (Entity-Relationship Diagram) of your database schema in MySQL Workbench:

  1. Open MySQL Workbench and open your database connection.

  2. In the top navigation bar, click on “Database” to expand the list of options.
    Image description

  3. Select “Reverse Engineer” from the database context menu.
    Image description

  4. In the “Reverse Engineer” dialogue box, click “Next” to set parameters for connecting to the Database Management System(DBMS).
    Image description

  5. Enter your password so that MySQL can connect to your DBMS and then click ‘’next’’.
    Image description

  6. Select the database schema for which you want to generate an ERD. And then click ‘’Next’’ again.
    Image description

  7. Enter your password again so that MySQL can retrieve and reverse engineer the schema objects for the schema you chose.
    Image description

  8. Click “Execute” to start the reverse engineering process. This may take a few moments depending on the size of your database.

  9. Click ‘’finish’’ to see the ERD of your database schema displayed in the main window of MySQL Workbench.

In the ERD tab, your ERD may look like this by default :
Image description

The default ERD above may require scrolling back and forth to make sense of its contents. But you can avoid this by customising the ERD layout by dragging the tables and resizing them so that you can see all of them at a glance without the need to scroll down.
Image description

And that’s a wrap!

Top comments (1)

Collapse
 
dana-fullstack-dev profile image
dana

For reverse engineering i think you can use alternative of this old desktop application. I use Online Database Design for reverse design of my existing database.