从现有架构/模型使用 MySQL Workbench 创建数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21314477/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Creating a database with MySQL Workbench from existing schema/model
提问by TheLettuceMaster
I built a database schema (or Model?) with MySQL Workbench
. I'd like to now make it into an actual database.
我用MySQL Workbench
. 我现在想把它变成一个实际的数据库。
I've seen Forward and Reverse engineer options and can't find a clear answer on if either are what I need.
我已经看到了正向和反向工程师选项,但无法找到明确的答案是否是我需要的。
How can I turn this into an actual database?
我怎样才能把它变成一个实际的数据库?
回答by digitai
This for mysql workbench version 6.0 and for exporting a schema.
这适用于 mysql 工作台 6.0 版和导出架构。
Select tab MySQL Model
Select File->Export->Forward Engineer SQL Create
Place a file name to be exported in the Output SQL Script File, choose your options, next
将要导出的文件名放在输出 SQL 脚本文件中,选择您的选项,下一步
Export MySQL table Objects,
filter tables
Then a file is created which you can import to your database and it creates schemas if not exists, creates tables if not exists.
然后创建一个文件,您可以将其导入到数据库中,如果不存在则创建模式,如果不存在则创建表。
In the case of models, you need to pay, many bucks, for a tool that creates schemas, tables, indexes, cascading, and all stuff associated to an existing data model.
对于模型,您需要为创建模式、表、索引、级联以及与现有数据模型相关联的所有内容的工具支付很多钱。
回答by Islay
The official documentation has a relevant article.
http://dev.mysql.com/doc/workbench/en/wb-getting-started-tutorial-creating-a-model.html
官方文档有相关文章。
http://dev.mysql.com/doc/workbench/en/wb-getting-started-tutorial-creating-a-model.html
Jump to step 11.
跳到第 11 步。
回答by Melebius
As of MySQL Workbench 8.0, go to the menu item Database > Forward Engineer. After specifying your database connection and model export options, you'll be able to create the database you have designed.
从 MySQL Workbench 8.0 开始,转到菜单项Database > Forward Engineer。指定数据库连接和模型导出选项后,您将能够创建您设计的数据库。
See MySQL Workbench Manual :: 9.4.1.2 Forward Engineering to a Live Serverfor details.
有关详细信息,请参阅MySQL Workbench Manual :: 9.4.1.2 Forward Engineering to a Live Server。
回答by Mike Lischke
In order to realize a modeled schema structure on a real server you would use either forward engineering or synchronization. The first is if you have just the model and want it to create all the objects in the target schema(s). Synchronization on the other hand is a means to synchronize your model and an existing schema (two-way). That is, objects not existing or changed in your model are created or adjusted on the server and vice versa. There's no need to create a separate SQL script and apply that manually.
为了在真实服务器上实现建模模式结构,您可以使用正向工程或同步。第一个是如果您只有模型并希望它在目标模式中创建所有对象。另一方面,同步是一种同步模型和现有模式(双向)的方法。也就是说,模型中不存在或未更改的对象在服务器上创建或调整,反之亦然。无需创建单独的 SQL 脚本并手动应用它。
For both action see the Database menue in MySQL Workbench when a model is open.
对于这两个操作,请在模型打开时查看 MySQL Workbench 中的数据库菜单。