概述
之前在部署时有一个报错就是因为show_compatibility_56参数引起的,不过没有对这个参数重点介绍,所以下面根据官网内容单独介绍一下。
官网介绍:
show_compatibility_56 is deprecated because its only purpose is to permit control over deprecated system and status variable information sources that will be removed in a future MySQL release. When those sources are removed, show_compatibility_56 will have no purpose and will be removed as well.
show_compatibility_56参数
MySQL5.6版本到5.7版本的更新包括一些不兼容的特性,在升级到5.7之前,我们需要知道这些不兼容的特性并手动更新,在其中涉及到REPAIR TABLE和USE_FRM选项的指令一定要在更新版本之前完成。
配置项更新:
1、--early-plugin-load
MySQL5.7.11,此参数的默认值为keyring_file(是一个二进制文件的插件),InnoDB表空间在初始化InnoDB之前需要此插件来加密,但是MySQL5.7.12及以后此参数默认为空,所以5.7.11升级到5.7.12后,如果已经在之前的版本中使用此插件对InnoDB表空间进行了加密,在开启服务时需要指定参数 --early-plugin-load
2、系统表
MySQL5.6中INFORMATION_SCHEMA 中存在系统变量和状态变量的表,show variables 和show status也是基于此库中的表,在5.7.6时被Performance Schema也存在这四张表,show 语句开始基于Performance Schema中的表,如果show_compatibility_56参数开启,则兼容5.6
开启show_compatibility_56
1、查看show_compatibility_56值MySQL> show variables like '%show_compatibility_56%';
2、把show_compatibility_56打开mysql> set global show_compatibility_56=on;
3、永久打开
在my.cnf增加一行参数show_compatibility_56 = 1
show_compatibility_56影响
影响以下方面:
Information available from the SHOW VARIABLES and SHOW STATUS statements
Information available from the INFORMATION_SCHEMA tables that provide system and status variable information
Information available from the Performance Schema tables that provide system and status variable information
The effect of the FLUSH STATUS statement on status variables
如果打开show_compatibility_56时,将启用与MySQL 5.6的兼容性。旧的变量信息源(show语句、information_schema表)产生的输出与mysql 5.6中相同。
当show_compatibility_56打开时,可以从show Status获得几个Slave_xxx状态变量。当show_compatibility_56关闭时,这些变量中的一些不会公开显示状态。它们提供的信息在与复制相关的性能架构表中可用,如后文所述。
关闭show_compatibility_56时,将禁用与mysql 5.6的兼容性。从信息架构表中进行选择会产生错误,因为性能架构表要替换它们。从mysql 5.7.6开始,information_schema表就被弃用,并将在以后的mysql版本中删除。
--把show_compatibility_56关闭
mysql> set global show_compatibility_56=off;
mysql> select * from information_schema.global_status limit 3;
--把show_compatibility_56打开
mysql> set global show_compatibility_56=on;
mysql> show variables like '%show_compatibility_56%';
mysql> select * from information_schema.global_status limit 3;
--In MySQL 5.6, system and status variable information is available from these SHOW statements:
SHOW VARIABLES
SHOW STATUS
And from these INFORMATION_SCHEMA tables:
INFORMATION_SCHEMA.GLOBAL_VARIABLES
INFORMATION_SCHEMA.SESSION_VARIABLES
INFORMATION_SCHEMA.GLOBAL_STATUS
INFORMATION_SCHEMA.SESSION_STATUS
--MySQL 5.7
--As of MySQL 5.7.6, the Performance Schema includes these tables as new sources of system and status variable information:
performance_schema.global_variables
performance_schema.session_variables
performance_schema.variables_by_thread
performance_schema.global_status
performance_schema.session_status
performance_schema.status_by_thread
performance_schema.status_by_account
performance_schema.status_by_host
performance_schema.status_by_user
篇幅有限,这块内容就介绍到这了。后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~