N
NJHTools

MySQL ER Diagram Online

Paste MySQL CREATE TABLE statements or a mysqldump --no-data file and get an ER diagram of your tables, keys and relationships in your browser. There is nothing to install and no database connection, which makes it a quick, lightweight way to view a schema without opening MySQL Workbench.

MySQL codeYour schema stays in this browser.

Tab indents. Press Esc, then Tab, to move focus out. Autosaved in this browser.

How to make a MySQL ER diagram

  1. 1Run mysqldump --no-data --skip-triggers mydb > schema.sql, or copy SHOW CREATE TABLE output.
  2. 2Keep MySQL selected and paste the SQL into the editor.
  3. 3Check the foreign key lines, primary keys and ENUM columns.
  4. 4Drag tables or re-run auto-layout to arrange the diagram.
  5. 5Export PNG or SVG, or MySQL, PostgreSQL or SQL Server SQL, DBML or Mermaid.

Getting your MySQL schema

mysqldump --no-data mydb > schema.sql writes every CREATE TABLE without rows; add --skip-triggers to leave out triggers. For a few tables, run SHOW CREATE TABLE table_name in any client and paste the result. In MySQL Workbench, Server > Data Export with Dump Structure Only produces the same kind of file.

The /*!40101 ... */ lines at the top of a dump are MySQL version comments. If any statement there or a stored procedure stops the parser, delete it and keep the CREATE TABLE statements.

Why foreign key lines can be missing in MySQL

Only InnoDB tables enforce foreign keys. Tables created with ENGINE=MyISAM, and schemas from frameworks that skip constraints, have columns like customer_id but no FOREIGN KEY clause, so there is nothing to draw a line from.

To document the intended relationships anyway, convert the SQL to DBML and add Ref lines such as Ref: orders.customer_id > customers.id. Exporting that DBML back to MySQL SQL then writes proper FOREIGN KEY constraints you can review and apply.

Naming conventions for tables and keys

Pick one style and keep it: lowercase snake_case works in every database without quoting, because PostgreSQL folds unquoted names to lowercase and MySQL table names can be case-sensitive on Linux. Decide once whether table names are plural (users) or singular (user).

Name foreign keys after the table they point at plus _id, such as user_id or order_id, so relationships are obvious even without the diagram. Avoid reserved words like user, order and group as table names; they work only when quoted, which is easy to forget in queries.

Use consistent suffixes for common columns: created_at and updated_at for timestamps, is_ or has_ prefixes for booleans, and the same type for a key and every foreign key that references it, for example bigint on both sides.

Frequently Asked Questions

Is this a MySQL Workbench alternative?↓

For viewing and sketching a schema diagram, it is a lightweight option that runs in the browser with nothing to install. It does not connect to a server, run queries or synchronise changes with a live database the way Workbench does; you paste SQL in and export SQL out.

How do I export my MySQL schema without data?↓

Run mysqldump --no-data mydb > schema.sql, or use SHOW CREATE TABLE for individual tables, then paste the SQL here. The tool never connects to your database.

Does it work with MariaDB?↓

Usually, yes. MariaDB uses the same CREATE TABLE syntax as MySQL for tables, keys and ENUM columns, so choose MySQL and paste the dump. Remove MariaDB-only statements if the parser reports an error on them.

Is my database schema private? Is anything uploaded?↓

Nothing is uploaded. Parsing, layout and every export run in your browser, and the diagram is autosaved only in this browser's local storage. There are no share links on purpose, because table and column names can reveal how a product works. No signup is needed.

Which export formats are available?↓

You can export CREATE TABLE SQL for PostgreSQL, MySQL, SQL Server or Oracle, the schema as DBML, a Mermaid erDiagram for Markdown docs on GitHub or GitLab, and the diagram itself as a PNG image or an SVG vector file. Convert SQL to DBML turns pasted SQL into DBML you can keep editing.

All Text & Dev Tools →

Last updated: