How to Create a New Database Diagram using MySQL Workbench

To create a new database diagram using MySQL Workbench:

  1. Click File > New Model from the menu
  2. Create a new schema by clicking the + icon next to Physical Schemas
  3. Add tables by clicking Add Tables, then add/configure their columns in the bottom pane.
  4. Create relationships and any other configurations by using the various tabs
  5. Create a diagram by clicking Model > Create Diagram from Catalog Objects

The diagram will be created. You can rearrange the tables to a more suitable layout by clicking and dragging.

Below are screenshots for the above steps.

Create a New Model

Click File > New Model from the menu:

Screenshot of selecting New Model from the File menu in MySQL Workbench
Selecting “New Model” from the File menu will enable you to create a new database model and/or diagram.

Create a New Schema

Create a new schema by clicking the + icon next to Physical Schemas:

Screenshot of creating a new schema model in MySQL Workbench
Clicking the “+” sign next to “Physical Schemas” adds a new schema. You can then add tables, columns, views, routines, and more.

Add Tables, Columns

Add tables by clicking Add Tables, then add/configure their columns in the bottom pane:

Screenshot of Design view of a table when creating a model using MySQL Workbench
Configuring a table when creating a model using MySQL Workbench. After adding a table, create each column and set its data type. Also specify whether it’s a primary key column, allows null values, auto-increment value, and more.

Create Relationships, etc

Create relationships and any other configurations by using the various tabs:

Screenshot of the Foreign Keys tab when modelling a database in MySQL Workbench
The “Foreign Keys” tab enables you to set up relationships between tables.

Generate the Diagram

Create a diagram by clicking Model > Create Diagram from Catalog Objects:

Screenshot of the Model > Create Diagram from Catalog Objects option from the menu bar in MySQL Workbench.
The “Create Diagram from Catalog Objects” in MySQL Workbench allows you to turn your model into a visual diagram.

The Diagram

The diagram will be created:

Screenshot of a newly generated diagram from a schema.
When MySQL Workbench generates your diagram, you might find all your tables piled on top of each other. Just click and drag them to a more suitable position, and you’ll find the relationship links will follow (and remain intact).

Rearrange if Necessary

You can rearrange the tables by clicking on the tables and dragging them to provide a more readable layout:

Diagram of a relationship between three tables in MySQL Workbench.
Diagram of a relationship between three tables. The primary key and foreign key fields have been highlighted.