如何永久禁用MySQL 8中的列统计? [英] How to disable column-statistics in MySQL 8 permanently?

查看:201
本文介绍了如何永久禁用MySQL 8中的列统计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于 MySQL 8 ,默认情况下已启用column-statistics标志.

Since MySQL 8 the column-statistics flag is enabled by default.

因此,如果尝试使用 MySQL Workbench 8.0.12转储某些表,则会收到以下错误消息:

So if you try to dump some tables with MySQL Workbench 8.0.12, you get this error message:

14:50:22转储db(table_name) 运行:mysqldump.exe --defaults-file ="c:\ users \ username \ appdata \ local \ temp \ tmpvu0mxn.cnf" --user = db_user --host = db_host --protocol = tcp --port = 1337- -default-character-set = utf8 --skip-triggers"db_name""table_name" mysqldump:无法执行"SELECT COLUMN_NAME,JSON_EXTRACT(HISTOGRAM,'$.指定的桶数"')FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME ='db_name'AND TABLE_NAME ='table_name';':未知表' information_schema中的"COLUMN_STATISTICS"(1109)

14:50:22 Dumping db (table_name) Running: mysqldump.exe --defaults-file="c:\users\username\appdata\local\temp\tmpvu0mxn.cnf" --user=db_user --host=db_host --protocol=tcp --port=1337 --default-character-set=utf8 --skip-triggers "db_name" "table_name" mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'db_name' AND TABLE_NAME = 'table_name';': Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

操作失败,退出代码为2 14:50:24 C:\ path \ to \ my \ dump的导出已完成,出现1个错误

Operation failed with exitcode 2 14:50:24 Export of C:\path\to\my\dump has finished with 1 errors

MySQL(Workbench)8中有什么方法可以永久禁用column-statistics?

Is there any way in MySQL (Workbench) 8 to disable column-statistics permanently?

一个烦人的解决方法是通过以下方式手动完成:

An annoying workaround is doing it by hand via:

mysqldump --column-statistics=0 --host=...


解决方法2

  1. 重命名mysqldump
  2. 创建 shell脚本(或Windows上的批处理)
  3. 在此脚本中使用--column-statistics=0参数调用重命名的mysqldump
  4. 将其另存为mysqldump
  1. rename mysqldump
  2. create a shell script (or batch on Windows)
  3. call the renamed mysqldump with the --column-statistics=0 argument within this script
  4. save it as mysqldump


解决方法3

  1. 下载 MySQL 5.7
  2. 提取mysqldump
  3. 使用此mysqldump

例如在MySQL Workbench中:编辑/首选项.../管理/mysqldump工具的路径

For example in MySQL Workbench: Edit / Preferences... / Administration / Path to mysqldump Tool

提前谢谢!

推荐答案

我的解决方法:

  1. 创建名为mysqldump.cmd的文件,内容如下:

    @echo off
    "c:\Program Files\MySQL\MySQL Workbench 8.0 CE\mysqldump.exe" %* --column-statistics=0

(如有必要,请替换为mysqldump.exe的路径)

(replace path to mysqldump.exe if necessary)

  1. 打开MySQL Workbench并转到编辑">首选项">管理",将路径更改为mysqldump工具,然后将其指向mysqldump.cmd

这篇关于如何永久禁用MySQL 8中的列统计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆