78

我想拿整个数据库。我在哪里可以找到数据库文件?

有没有办法将带有所有数据的整个数据库写入文本文件(如 SQL Server 中的文件)?

4

11 回答 11

104

如何在 Workbench 中为您的数据库生成 SQL 脚本

  1. Workbench Central(默认的“主页”选项卡)中连接到您的 MySQL 实例,打开一个SQL 编辑器选项卡。
  2. 单击SQL 编辑器选项卡并从左侧对象浏览器的SCHEMAS列表中选择您的数据库。
  3. 从菜单中选择Database > Reverse Engineer并按照提示进行操作。该向导将引导您连接到您的实例、选择您的数据库以及选择您想要逆向工程的对象类型。全部完成后,您将拥有至少一个名为MySQL模型的新选项卡。您可能还有一个名为EER 图的选项卡,它很酷但与此处无关。
  4. 单击MySQL 模型选项卡
  5. 选择Database > Forward Engineer
  6. 按照提示进行操作。许多选项都会出现,包括Generate INSERT Scripts for Tables,它允许您编写包含在表中的数据的脚本(非常适合查找表)。
  7. 很快你就会在你面前看到生成的脚本。此时您可以Copy to ClipboardSave to Text File

The wizard will take you further, but if you just want the script you can stop here.

A word of caution: the scripts are generated with CREATE commands. If you want ALTER you'll have to (as far as I can tell) manually change the CREATEs to ALTERs.

This is guaranteed to work, I just did it tonight.

于 2011-10-23T02:27:10.347 回答
30

Q#1:我猜它在你的 MySQL 服务器上的某个地方?Q#2:是的,这是可能的。您必须通过服务器管理建立连接。在那里,您可以克隆任何表或整个数据库。

本教程可能有用。

编辑

由于提供的链接不再处于活动状态,因此这里有一个SO 答案,概述了在 Workbench 中创建数据库备份的过程。

于 2011-02-08T08:10:53.393 回答
13

In MySQL Workbench 6, commands have been repositioned as the "Server Administration" tab is gone.

You now find the option "Data Export" under the "Management" section when you open a standard server connection.

于 2013-10-10T11:03:54.227 回答
11

there is data export option in MySQL workbech

enter image description here

于 2013-10-16T16:51:57.523 回答
9

I found this question by searching Google for "mysql workbench export database sql file". The answers here did not help me, but I eventually did find the answer, so I am posting it here for future generations to find:

Answer

In MySQLWorkbench 6.0, do the following:

  1. Select the appropriate database under MySQL Connections
  2. On the top-left hand side of screen, under the MANAGEMENT heading, select "Data Export".

Here is a screenshot for reference:

enter image description here

于 2015-10-15T21:47:30.890 回答
2

试试phpMyAdmin的导出功能。

我认为也有可能将数据库文件从一台服务器复制到另一台服务器,但我目前没有可用的服务器,因此无法对其进行测试。

于 2011-02-08T08:01:41.620 回答
2

在 MySQL Workbench 的顶部菜单中单击数据库,然后单击正向工程师。在您将看到的选项菜单中,确保设置了“为表生成插入语句”。

于 2011-02-08T08:11:31.347 回答
2

None of these worked for me. I'm using Mac OS 10.10.5 and Workbench 6.3. What worked for me is Database->Migration Wizard... Flow the steps very carefully

于 2015-12-29T14:31:58.917 回答
1

Using Windows 10 and MySql Workbench 8.0

  1. Go to Server tab
  2. Go to Database Export

This opens up something like this

MySQL Workbench

  1. Select the schema to export in the Tables to export
  2. Click the button Start Export
于 2020-03-29T10:21:44.533 回答
0

Surprisingly the Data Export in the MySql Workbench is not just for data, in fact it is ideal for generating SQL scripts for the whole database (including views, stored procedures and functions) with just a few clicks. If you want just the scripts and no data simply select the "Skip table data" option. It can generate separate files or a self contained file. Here are more details about the feature: http://dev.mysql.com/doc/workbench/en/wb-mysql-connections-navigator-management-data-export.html

于 2014-05-28T13:12:28.070 回答
0

in mysql workbench server>>>>>>export Data then follow instructions it will generate insert statements for all tables data each table will has .sql file for all its contained data

于 2015-08-15T20:57:01.937 回答