mysqldump throws: Unknown table 'COLUMN_STATISTICS' in information_schema (1109)
Solution 1:
This is due to a new flag that is enabled by default in mysqldump 8. You can disable it by adding --column-statistics=0. The command will be something like:
mysqldump --column-statistics=0 --host=<server> --user=<user> --password=<password>
Check this link for more information. 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 2:
For those using MySQL Workbench, there is an "Advanced Options" button on the Data Export screen. The option "Use Column Statistics" can be disabled by setting to 0.
I have not confirmed, but the following information has been suggested to also be true: In Version 8.0.14 it's missing. In Version 8.0.16 it's doing this by default.
Solution 3:
I spent the whole day looking for a solution, and singed up here just to share mine.
Yes, probably this error is due to versions difference.
Just download the MySQL 5.7 ZIP Archive from here: https://dev.mysql.com/downloads/mysql/ and unzip it, then use the mysqldump.exe file from there.
If you are using MySQL Workbench, you will need to set a path to the mysqldump Tool you downloaded by going to Edit -> Preferences -> Administration (from left hand pane).
Hope this helps.
Solution 4:
Easiest Work Around
When using Mysql Workbench 8.0
- Open the "Data Export" Tab
- Click Advanced Options
- Under the Other heading, set column statistics to 0
- Export again
Best of luck!
Solution 5:
To make this answer easier, you can rename mysqldump
, make a shell script in its place and call the renamed mysqldump
with the --column-statistics=0
argument. Eg:
Rename mysqldump:
mv /usr/local/bin/mysqldump /usr/local/bin/_mysqldump
Save the following shell script in its place:
#!/bin/sh
_mysqldump --column-statistics=0 $@