Can't export my database from mysql workbench

2020-02-07 17:03发布

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

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

Do you have any idea what might going wrong? Thanks

10条回答
够拽才男人
2楼-- · 2020-02-07 17:29

In MySql Workbench version 8.0.13 do the following steps:

  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)

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

查看更多
3楼-- · 2020-02-07 17:30

I found this condition in wb_admin_export.py instead of a commented --column-statistics=0. you can remove the else False condition, or change it to 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
查看更多
成全新的幸福
4楼-- · 2020-02-07 17:36

To summarize what I did from the helpful comments of @JustinLaureno and @Mohd.Shaizad, tested on 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 NOT add inline comments or it won't work!

    skip_column_statistics = True # This won't work

  • Restart MySQL Workbench
  • Perform the export
查看更多
你好瞎i
5楼-- · 2020-02-07 17:37

I had the same issue 5 minutes ago.

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

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

enter image description here

查看更多
我命由我不由天
6楼-- · 2020-02-07 17:47

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

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.

After that, the error no longer appeared.

查看更多
仙女界的扛把子
7楼-- · 2020-02-07 17:47

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

查看更多
登录 后发表回答