mysql默认schema_一文看懂mysql数据库兼容性参数--show_compatibility_56

概述

之前在部署时有一个报错就是因为show_compatibility_56参数引起的,不过没有对这个参数重点介绍,所以下面根据官网内容单独介绍一下。

官网介绍:

a6898307e98fe92587822daf02c8e404.png

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%';
368f8c4aa5cc81a948dfd305746f55d7.png

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 VARIABLESSHOW STATUSAnd from these INFORMATION_SCHEMA tables:INFORMATION_SCHEMA.GLOBAL_VARIABLESINFORMATION_SCHEMA.SESSION_VARIABLESINFORMATION_SCHEMA.GLOBAL_STATUSINFORMATION_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_variablesperformance_schema.session_variablesperformance_schema.variables_by_threadperformance_schema.global_statusperformance_schema.session_statusperformance_schema.status_by_threadperformance_schema.status_by_accountperformance_schema.status_by_hostperformance_schema.status_by_user
fd031bf27e84ed97f23c4b7a72ef5d68.png
c4ba26b737c4ce9da3a11f9972cffc29.png

篇幅有限,这块内容就介绍到这了。后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~

6d68b01039718b22d205907feb55f730.gif
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值