Unknown table ‘column_statistics‘ in information_schema (1109)

在这里插入图片描述

错误信息

使用 MySQL Workbench 导出数据时总是报Unknown table 'column_statistics' in information_schema (1109)的错误。

下面是我在导出ApolloPortalDBUsers表的数据时 MySQL Workbench 的错误提示。

16:50:54 Dumping ApolloPortalDB (Users)
Running: /Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump --defaults-file="/var/xxxx/xxx/xxxx/T/xxx/extraparams.cnf"  --user=root --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8 --skip-triggers --no-create-info "ApolloPortalDB" "Users"
mysqldump: Couldn't execute 'SELECT COLUMN_NAME,                       JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"')                FROM information_schema.COLUMN_STATISTICS                WHERE SCHEMA_NAME = 'ApolloPortalDB_V192' AND TABLE_NAME = 'Users';': Unknown table 'column_statistics' in information_schema (1109)

Operation failed with exitcode 2
16:50:55 Export of /Users/uwoerla/dumps/Dump20221222 has finished with 1 errors

这种情况一般是 MySQL8.0+ 高版本的 mysqldump 命令去访问低版本的 MySQL 实例时发生。

这个如何解决呢?

临时解决办法

找到Data Export功能交互流程中的Advanced Options设置入口

点击Advanced Options按钮。

在打开的界面中找到 column-statistics - Writing ANALYZE TABLE statements to generate statistics historams (set 0 to diasble). 这个设置项把它的值由TRUE修改为0即可。

修改前

修改后

这样你就可以愉快的导出数据了。

永久解决办法

但是

凡事都有但是,这种方法当你重启MySQL Workbench的时候上面设置的column-statistics参数又回到了原样,它的值又变回了TRUE

有没有什么办法能一劳永逸呢?

当然有了,在你进行Data Export功能交互流程中一般会有一个提示

看到标题中的mysqldump Version Mismatch你就应大概知道怎么回事儿了。

再看看内容

/Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump is version 8.0.13, but the MySQL Server to be dumped has version 5.7.30.
Because the version of mysqldump is not the same as the server, some features may not be backed up properly.
It is recommended you upgrade or downgrade your local MySQL client programs, including mysqldump, to a version equal to or newer than that of the target server.
The path to the dump tool must then be set in Preferences -> Administrator -> Path to mysqldump Tool:

客户端的mysqldump的版本是 8.0.13 ,服务端的版本是 5.7.30,让我们去Preferences -> Administrator -> Path to mysqldump Tool这个路径去设置客户端的mysqldump

默认情况下,这里并没有设置。

根据自己的情况安装对应版本的mysqldump然后去设置即可。

这样即使你重启MySQL Workbench依然可以流畅的使用Data Export的功能。

猜你喜欢

转载自blog.csdn.net/uwoerla/article/details/128425524
今日推荐