Can't export my database from mysql workbench

MysqlDatabaseExportMysql Workbench

Mysql Problem Overview


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

Mysql Solutions


Solution 1 - Mysql

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.

Solution 2 - Mysql

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.

Solution 3 - Mysql

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

Solution 4 - Mysql

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

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

Syntax :

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

For more info please go to this 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.

Solution 5 - Mysql

Bug still in 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).

The required parameter will now be always added.

Solution 6 - Mysql

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

Solution 7 - Mysql

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.

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

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

Now Return and Export the Data. Thank You

Solution 8 - Mysql

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"

Solution 9 - Mysql

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

Solution 10 - Mysql

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

Solution 11 - Mysql

From Mysql-workbench version 8.0.14 you don't have the option to disable column-statistics.

But you have an option to do it by enabling delete-master-logs: Mysql-workbench version 8.0.22

  • --delete-master-logs has the same effect as the "RESET MASTER" SQL command

  • RESET MASTER deletes all binary log files listed in the index file, resets the binary log index file to be empty, and creates a new binary log file. This statement is intended to be used only when the master is started for the first time.

Solution 12 - Mysql

I faced the same issue with MySQL workbench latest edition, I resolved it using the mysqldump command line

C:\Program Files\MySQL\MySQL Workbench 8.0 CE\mysqldump --column-statistics=0  --user=USERNAME --host=REMOTE_HOST --protocol=tcp --port=3306 --default-character-set=utf8 DATABASE_NAME > c:\temp\dump.sql --password

Replace USERNAME, REMOTE_HOST, DATABASE_NAME with your names.

Solution 13 - Mysql

On MACOS, just downgrade to version 8.0.13, that's the only thing did the job for us.

The following link can help

https://downloads.mysql.com/archives/workbench/

MacOS MySQL Work Bench 8.0.13

If you are using SSH key to access remote database then do the following -:

Step 1

brew install putty

Step 2

puttygen id_rsa -O private-openssh -o id_rsa.pem

Step 3 - In MySQL workbench

SSH Key File: /Users/local/.ssh/id_rsa.pem

Hope it helps someone because it wasted 3 hours of our time :)

Solution 14 - Mysql

in version 8, I modified "wb_admin_export.py" and restart workbench. works for me

def start(self):
.
.
.
    title = "Dumping " + schema
    title += " (%s)" % table
    # description, object_count, pipe_factory, extra_args, objects
    args = []
    args.append('--column-statistics=0')
class ViewsRoutinesEventsDumpData(DumpThread.TaskData):
    def __init__(self, schema, views, args, make_pipe):
        title = "Dumping " + schema + " views and/or routines and/or events"
        if not views:
           extra_args = ["--no-create-info"]
        else:
            extra_args = []
        DumpThread.TaskData.__init__(self,title, len(views), ["--skip-triggers", " --no-data" ," --no-create-db", "--column-statistics=0"] + extra_args + args, [schema] + views, None, make_pipe)```

Solution 15 - Mysql

You can use native MySQL Workbench "Migration wizard" to migrate data without errors. It can be found in menu Database -> Migration Wizard It can transfer data "online" but I didn't found an option to create a dump file with it. It is a pretty good solution for migrations

Solution 16 - Mysql

If you are using windows with XAMPP, you need to indicate the path through XAMP. Do the following:

In your MySQL Workbench: Go to edit -> preferences -> administration under "Path to mysqldump tool" enter the path: C:\xampp\mysql\bin\mysqldump.exe then click ok.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionthe essentialView Question on Stackoverflow
Solution 1 - MysqlArtemView Answer on Stackoverflow
Solution 2 - MysqlSander BouwhuisView Answer on Stackoverflow
Solution 3 - MysqlSharpCView Answer on Stackoverflow
Solution 4 - MysqlAmitesh BhartiView Answer on Stackoverflow
Solution 5 - MysqlWolframView Answer on Stackoverflow
Solution 6 - MysqlMatt KomarnickiView Answer on Stackoverflow
Solution 7 - MysqlSunil ValmikiView Answer on Stackoverflow
Solution 8 - MysqlYosbel SantanaView Answer on Stackoverflow
Solution 9 - MysqlJustin LaureanoView Answer on Stackoverflow
Solution 10 - MysqlMohd. ShaizadView Answer on Stackoverflow
Solution 11 - MysqlNob HoklengView Answer on Stackoverflow
Solution 12 - MysqlHany SakrView Answer on Stackoverflow
Solution 13 - Mysqluser63323View Answer on Stackoverflow
Solution 14 - MysqlchunkiatView Answer on Stackoverflow
Solution 15 - MysqlOleksandr GrinView Answer on Stackoverflow
Solution 16 - MysqlPierre VieiraView Answer on Stackoverflow