无法从 mysql 工作台导出我的数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50803608/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 22:57:14  来源:igfitidea点击:

Can't export my database from mysql workbench

mysqldatabaseexportmysql-workbench

提问by the essential

I am trying to export my database from MySQL Workbench but I get this during the export progress:

我正在尝试从 MySQL Workbench 导出我的数据库,但在导出过程中我得到了这个:

Running: mysqldump.exe --defaults-file="c:\users\user\appdata\local\temp\tmp2h91wa.cnf" --user=root --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8 --skip-triggers "mydb" mysqldump: Couldn't execute 'SELECT COLUMN_NAME,
JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')
FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'mydb' AND TABLE_NAME = 'courses';': Unknown table 'column_statistics' in information_schema (1109)

Operation failed with exitcode 2 20:55:09 Export of C:\Users\user\Documents\dumps\mydb.sql has finished with 1 errors

运行:mysqldump.exe --defaults-file="c:\users\user\appdata\local\temp\tmp2h91wa.cnf" --user=root --host=localhost --protocol=tcp --port=3306 - -default-character-set=utf8 --skip-triggers "mydb" mysqldump: 无法执行 'SELECT COLUMN_NAME,
JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')
FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'mydb' AND TABLE_NAME = 'courses';':information_schema 中的未知表 'column_statistics' (1109)

操作失败,退出代码 2 20:55:09 导出 C:\Users\user\Documents\dumps\mydb.sql 已完成 1 个错误

Do you have any idea what might going wrong? Thanks

你知道可能会出什么问题吗?谢谢

回答by S.H.Bouwhuis

In MySql Workbench version 8.0.13 do the following steps:

在 MySql Workbench 版本 8.0.13 中执行以下步骤:

  1. Go to Management/Data export
  2. Choose the schema to export in the 'Tables to export' list
  3. Click the 'Advanced Options...' button (top right)
  4. Search for the option 'Other/column-statistics'
  5. Set the value to 0
  6. Click the 'Return' button (top right)
  1. 转到管理/数据导出
  2. 在“要导出的表”列表中选择要导出的架构
  3. 单击“高级选项...”按钮(右上角)
  4. 搜索选项“其他/列统计”
  5. 将值设置为 0
  6. 单击“返回”按钮(右上角)

Now it should work. Unfortunately, you'll have to do that every time you start MySql Workbench.

现在它应该可以工作了。不幸的是,每次启动 MySql Workbench 时都必须这样做。

回答by Artem

Also ran into this problem. Decided as follows: In the Workbench menu, go to:

也遇到了这个问题。决定如下: 在 Workbench 菜单中,转到:

Edit - Preferences - Administration

编辑 - 首选项 - 管理

In the field "Path to mysqldump Tool", prescribe the path to mysqldump.exe, in my case "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe", click OK.

在“ mysqldump 工具的路径”字段中,指定mysqldump.exe的路径,在我的情况下为“ C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe”,单击“确定”。

After that, the error no longer appeared.

之后,错误不再出现。

回答by Amitesh

It is due to a flag that is by default "enabled" in mysqldump 8.

这是由于在 mysqldump 8 中默认“启用”的标志。

That can be disabled by adding --column-statistics=0.

这可以通过添加 --column-statistics=0 来禁用。

Syntax :

句法 :

mysqldump --column-statistics=0 --host=<server> --user <user> --password <securepass> 

For more info please go to link

欲了解更多信息,请转到链接

To disable column statistics by default, you can add

要默认禁用列统计信息,您可以添加

[mysqldump]
column-statistics=0

to a MySQL config file, such as /etc/my.cnf or ~/.my.cnf.

到 MySQL 配置文件,例如 /etc/my.cnf 或 ~/.my.cnf。

回答by Sunil Valmiki

I too had the same problem.. I am able to resolve this Issue by disabling the column-statistics in the advanced options of the MySQL Workbench Data Export.

我也有同样的问题。我可以通过在 MySQL Workbench 数据导出的高级选项中禁用列统计来解决这个问题。

1: Click on the advanced options: enter image description here

1:点击高级选项: 在此处输入图片说明

2: In the other section for the column-statistics remove TRUE and set it to 0 to disable it. enter image description here

2:在列统计的另一部分中,删除 TRUE 并将其设置为 0 以禁用它。 在此处输入图片说明

Now Return and Export the Data. Thank You

现在返回和导出数据。谢谢你

回答by Matt Komarnicki

I had the same issue 5 minutes ago.

5 分钟前我遇到了同样的问题。

I fixed it by adding in my mysqldumpcommand --column-statistics=0. Do it and it should work.

我通过添加我的mysqldump命令来修复它--column-statistics=0。这样做,它应该工作。

In my case it's a phing task but you should get the idea.

就我而言,这是一项 phing 任务,但您应该明白这一点。

enter image description here

在此处输入图片说明

回答by Wolfram

Bug still in Workbench 8.0.16.

错误仍然在 Workbench 8.0.16 中。

Fix:

使固定:

You can edit wb_admin_export.py under modules in the workbench program directory. Search for "skip_column_statistics = True" (you will find a conditional, don't worry), comment that line and add a line "skip_column_statistics = True" (without a conditional).

您可以在工作台程序目录中的模块下编辑 wb_admin_export.py。搜索“skip_column_statistics = True”(你会找到一个条件,别担心),注释该行并添加一行“skip_column_statistics = True”(没有条件)。

The required parameter will now be always added.

现在将始终添加所需的参数。

回答by Yosbel Santana

I had the same problem and I solved it like this:

我遇到了同样的问题,我是这样解决的:

edit the workbench preferences: Edit -> Preferences -> Administration

编辑工作台首选项:编辑 -> 首选项 -> 管理

in the property "Path to mysqldump Tool" place the path of your mysqldump.exe It is usually found in "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe"

在属性“Path to mysqldump Tool”中放置你的 mysqldump.exe 的路径 它通常在“C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe”中

回答by SharpC

To summarize what I did from the helpful comments of @JustinLaureno and @Mohd.Shaizad, tested on MySQL Workbench 8.0.18:

总结一下我从 @JustinLaureno 和 @Mohd.Shaizad 的有用评论中所做的工作,在 MySQL Workbench 8.0.18 上进行了测试:

  • Navigate to C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules
  • Edit the file wb_admin_export.py(you need admin permissions for this)
  • amend the line:

    skip_column_statistics = True if get_mysqldump_version() > Version(8, 0, 2) and self.owner.ctrl_be.target_version < Version(8, 0, 0) else False

  • to:

    skip_column_statistics = True

  • DO NOTadd inline comments or it won't work!

    skip_column_statistics = True # This won't work

  • Restart MySQL Workbench
  • Perform the export
  • 导航 C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules
  • 编辑文件wb_admin_export.py(您需要管理员权限)
  • 修改行:

    skip_column_statistics = True if get_mysqldump_version() > Version(8, 0, 2) and self.owner.ctrl_be.target_version < Version(8, 0, 0) else False

  • 到:

    skip_column_statistics = True

  • 不要添加内联注释,否则将不起作用!

    skip_column_statistics = True # 这不起作用

  • 重启 MySQL 工作台
  • 执行导出

回答by Justin Laureano

I found this condition in wb_admin_export.pyinstead of a commented --column-statistics=0. you can remove the else Falsecondition, or change it to else True.

我在wb_admin_export.py而不是评论中发现了这种情况--column-statistics=0。您可以删除else False条件,或将其更改为else True

skip_column_statistics = True if get_mysqldump_version() > Version(8,
0, 2) and self.owner.ctrl_be.target_version < Version(8, 0, 0) else
True

回答by Mohd. Shaizad

Go to C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modulesand open this file wb_admin_export.pyand uncomment "--column-statistics=0" then Restart the workbench

转到C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules并打开此文件wb_admin_export.py并取消注释“ --column-statistics=0”然后重新启动工作台