简体   繁体   English

如何在mysql中创建ER图

[英]How to create E-R diagram in mysql

I am using MySQL.我正在使用 MySQL。 There are 28 tables in my database.我的数据库中有 28 个表。 I've tried to use MySQL Workbench to create ER diagram.我尝试使用 MySQL Workbench 创建 ER 图。 As there are 28 tables, everything is messed up in diagram using MySQL Workbench.由于有 28 个表,使用 MySQL Workbench 的图表中的所有内容都被搞乱了。 Is there any way to create ER Diagram which shows all relations properly between 28 tables??有什么方法可以创建 ER 图表来正确显示 28 个表之间的所有关系?

Thanks谢谢

The only free app I've been able to find that generates decent graphics (not beautiful but quite clear) is SchemaSpy .我能找到的唯一一个能生成不错图形(不漂亮但很清晰)的免费应用程序是SchemaSpy It's a command line Java program that generates quite comprehensive HTML documentation for any DBMS.它是一个命令行 Java 程序,可为任何 DBMS 生成相当全面的 HTML 文档。

To Create ER Diagram in MySQL follow these steps:要在 MySQL 中创建 ER 图,请按照下列步骤操作:

1.First install MySQL Workbench in your computer 1.首先在你的电脑上安装MySQL Workbench

  1. Click File->Import->Reverse Engineer MySQL Create Script.点击 File->Import->Reverse Engineer MySQL Create Script。
  2. Click Browse and select your SQL create script.单击浏览并选择您的 SQL 创建脚本。
  3. Make Sure "Place Imported Objects on a diagram" is checked.确保选中“在图表上放置导入的对象”。
  4. Click Execute Button.单击执行按钮。
  5. Click Model->Add Diagram.单击模型-> 添加图表。
  6. Open Catalog Tree and select/drag your tables on your ERR diagram.打开目录树并选择/拖动您的 ERR 图上的表格。

SQL yog is one of the best tool which generate ERD and represents the relationship between different tables. SQL yog 是生成 ERD 并表示不同表之间关系的最佳工具之一。 It is also drag and drop utility and provide complete access to your mysql database.它也是拖放实用程序,并提供对 mysql 数据库的完全访问。

Open the MySQL Workbench and then go to Database -> Reverse Engineer ( in this wizard you have 7 steps to generate the ER Diagram )打开MySQL Workbench ,然后转到Database -> Reverse Engineer在此向导中,您有 7 个步骤来生成 ER 图表

1-Connection Options: 1-连接选项:

For Stored Connection :( Select local instance ) 对于存储连接:(选择本地实例)

For Password: Click on the Store in Vault.. and then enter your password对于密码:单击 Vault 中的 Store.. 然后输入您的密码

Then click on the next.然后点击下一步。

2-Connect to DBMS: 2-连接到 DBMS:

Click on the next (In this step you do not need to do anything) 点击下一步(在这一步你不需要做任何事情)

3-Select Schemas 3-选择模式

Here, select your desire Schema in order to generate an ER Diagram 在这里,选择您想要的架构以生成 ER 图表

4-Retrieves Objects 4-检索对象

Click on the next (In this step you do not need to do anything) 点击下一步(在这一步你不需要做任何事情)

5-Select Objects 5-选择对象

In this step, you can click on the Show Filter to exclude some table if you like 在此步骤中,您可以单击“显示过滤器”以排除某些表(如果您愿意)

在此处输入图片说明 Here, I exclude the emailAddresses table in order not to show that in the ER Diagram在这里,我排除了 emailAddresses 表,以免在 ER 图中显示

6-Reverses Engineers 6-逆向工程师

Click on the next (In this step you do not need to do anything) 点击下一步(在这一步你不需要做任何事情)

7-Results 7-结果

Click on the finish to see the Diagram 点击完成查看图表

ERWin is another good tool. ERWin 是另一个好工具。 Allowing you to generate erd from sql code and sql code from er diagrams.允许您从 sql 代码生成 erd 和从 er 图生成 sql 代码。 Its a Drag and Drop utility.它是一个拖放实用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM