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的功能。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值