如何使用数据导出 MySQL 模式?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13566735/
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
How to export MySQL schema with data?
提问by junaidp
I have a complete schema with many tables with data in them in MySQL query browser. Now I want to send this complete database with all the tables/data to my colleague. How can I send this to my colleague, so that he can then place this complete schema in his MySQL Query browser?
我有一个完整的架构,其中包含许多表,其中包含 MySQL 查询浏览器中的数据。现在我想将这个包含所有表/数据的完整数据库发送给我的同事。我如何将它发送给我的同事,以便他可以将这个完整的模式放在他的 MySQL 查询浏览器中?
Thanks.
谢谢。
回答by Goran Usljebrka
I`m not sure where are you working, you could export it to file, and send it to your friend. (root is my localhost username)
我不确定你在哪里工作,你可以将它导出为文件,然后发送给你的朋友。(root 是我的本地主机用户名)
mysqldump -u root -p --databases DB_NAME >databasename.sql
PS: mysqldump is actually a executable file present in your /MySQL\MySQL Server 5.6\bin
PS:mysqldump 实际上是一个存在于 /MySQL\MySQL Server 5.6\bin 中的可执行文件
for example [ on windows ]
例如[在Windows上]
C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin\mysqldump.exe
or [ on linux ]
或 [在 linux 上]
/usr/bin/mysqldump
回答by Malkus
You can use the mysqldumpcommand.
您可以使用mysqldump命令。
If you are using MySQL Workbench open the server administration tab and you can do an Export To Diskfrom there using a GUI interface.
如果您使用 MySQL Workbench,请打开服务器管理选项卡,您可以使用 GUI 界面从那里执行导出到磁盘。
There are options to dump to a single file or directory, and whether to include data or not.
可以选择转储到单个文件或目录,以及是否包含数据。
回答by r4d1um
you could export the database as a *.sql file using phpMyAdmin.
您可以使用 phpMyAdmin 将数据库导出为 *.sql 文件。
or write a C++/C#/Java etc Programm that generates such statements too.
或者编写一个 C++/C#/Java 等程序来生成这样的语句。
http://fragments.turtlemeat.com/mysql-database-backup-restore-phpmyadmin.php
http://fragments.turtlemeat.com/mysql-database-backup-restore-phpmyadmin.php
I am no way affiliated with turtlemeat
我与龟肉没有任何关系