从MySql Workbench浏览和修改SQL转储

时间:2020-12-30 23:12:17

I have a mysqldump from an SQL server and i want to open it in a program like MySQL Workbench or DBeaver so that i can easily search it and remove some values etc.

我在SQL服务器上有一个mysqldump,我想在MySQL Workbench或DBeaver这样的程序中打开它,这样我就可以轻松地搜索它并删除一些值等。

I'm trying to use MySQL Workbench however am unsure if i can import this SQL DUMP directly into here from the file like this. I have created in a new model and clicked import and it seems to show all my tables however they are empty.

我正在尝试使用MySQL Workbench,但是我不确定是否可以从这个文件中直接导入这个SQL转储。我在一个新模型中创建并单击import,它似乎显示了所有的表,但是它们是空的。

Is this possible and how would i go about this?

这可能吗?我该怎么做呢?

2 个解决方案

#1


1  

As far as I remember, MySQLDump exports the database to an sql script with a .sql file extension?

据我所知,MySQLDump将数据库导出到带有.sql文件扩展的sql脚本中?

In MySQL Workbench, open this file Using File->Open SQL Script or alternatively CTRL+SHIFT+O

在MySQL Workbench中,使用file ->打开SQL脚本或交替使用CTRL+SHIFT+O打开这个文件

Running the script should then create the database

然后运行脚本应该创建数据库

#2


1  

MySQL Workbench can restore a dump without loading it first into an editor (and hence can even handle gigabyte sized dumps). For this go to the Data Import/Restore admin section,

MySQL Workbench不需要首先将转储加载到编辑器中就可以恢复转储(因此甚至可以处理gb大小的转储)。为此,请转到数据导入/恢复管理部分,

从MySql Workbench浏览和修改SQL转储

select your dump, set options (e.g. what of the dump to restore) and click Start Import to start the process.

选择转储,设置选项(例如要恢复的转储是什么),然后单击Start Import启动进程。

However this doesn't allow to change the dump and because of usual dump sizes even browsing them is often not possible. You can try to load the dump file into an editor if it is not too large (say around 250MB, depending on system RAM). If it is much larger you can only try special tools like hex editors (which load large files piece by piece).

然而,这并不允许更改转储,而且由于通常的转储大小,即使浏览它们也是不可能的。如果转储文件不太大,您可以尝试将其加载到编辑器中(根据系统RAM,大约250MB)。如果它更大,您只能尝试一些特殊的工具,比如十六进制编辑器(它逐块加载大文件)。

#1


1  

As far as I remember, MySQLDump exports the database to an sql script with a .sql file extension?

据我所知,MySQLDump将数据库导出到带有.sql文件扩展的sql脚本中?

In MySQL Workbench, open this file Using File->Open SQL Script or alternatively CTRL+SHIFT+O

在MySQL Workbench中,使用file ->打开SQL脚本或交替使用CTRL+SHIFT+O打开这个文件

Running the script should then create the database

然后运行脚本应该创建数据库

#2


1  

MySQL Workbench can restore a dump without loading it first into an editor (and hence can even handle gigabyte sized dumps). For this go to the Data Import/Restore admin section,

MySQL Workbench不需要首先将转储加载到编辑器中就可以恢复转储(因此甚至可以处理gb大小的转储)。为此,请转到数据导入/恢复管理部分,

从MySql Workbench浏览和修改SQL转储

select your dump, set options (e.g. what of the dump to restore) and click Start Import to start the process.

选择转储,设置选项(例如要恢复的转储是什么),然后单击Start Import启动进程。

However this doesn't allow to change the dump and because of usual dump sizes even browsing them is often not possible. You can try to load the dump file into an editor if it is not too large (say around 250MB, depending on system RAM). If it is much larger you can only try special tools like hex editors (which load large files piece by piece).

然而,这并不允许更改转储,而且由于通常的转储大小,即使浏览它们也是不可能的。如果转储文件不太大,您可以尝试将其加载到编辑器中(根据系统RAM,大约250MB)。如果它更大,您只能尝试一些特殊的工具,比如十六进制编辑器(它逐块加载大文件)。