bug_x

导航

 

Mysql 8.0 版本 参数修改

      

最近整理了一下MySQL 8.0的自动化安装,其中用到了一个MySQL 5.7版本的自定义配置文件,由于没有对(MySQL 8.0)做针对性修改,导致安装过程中出现了一些错误
其中部分原因就是MySQL 5.7时代的配置在MySQL 8.0不再被支持,同时某些参数不再建议使用,如果继续保留在配置文件中,会导致8.0实例无法启动。


query cache被弃用

MySQL 8.0不在支持query cache,因此query cache相关的参数被移除
1,query_cache_type 
2,query_cache_size 

binlog相关的参数

expire-logs-days:被binlog_expire_logs_seconds替代,但是MySQL 8.0 下 expire-logs-days尚被支持
如果要管理binlog,参数为:skip-log-bin = 1

 

查询了一下相关的资料,发现这篇文章总结的相对比较全面一点,译文如下:


本文总结了MySQL 8.0第一版中删除的参数和特性。一些参数和特性在MySQL 8.0中被设置为弃用。
其他一些在MySQL 5.7或更早的版本中被设置为弃用,但是在MySQL 8.0中被删除了。


WL#7704:InnoDB: Remove deprecated file format parameters in 8.0
支持文件格式配置的目的是保持与早期版本的兼容性。在MySQL 8.0之前的版本中,支持两种主要的文件格式:
1,Antelope:对应的行格式为:紧凑、冗余。
2,Barracuda:新的文件格式。对应的行格式是:压缩的、动态的。
由于早期版本已经经过了长时间维护,旧的文件格式不再在MySQL 8.0中维护。
因此,删除旧代码有助于澄清代码结构。删除了与file_format相关的几个参数:
innodb_file_format
innodb_file_format_check
innodb_file_format_max
innodb_large_prefix
删除INFORMATION_SCHEMA中与文件格式相关的列:innodb_sys_tables,提交代码后,大量的代码被删除,结构看起来更清晰。

WL#8157: Remove deprecated GIS functions
删除与GIS相关的旧功能。新函数被替换为ST_xxx。总共删除了67个函数,包括它们的测试用例。

WL#8843: Deprecate and remove the parameter innodb_support_xa
删除参数innodb_support_xa。原因是这个参数是无效的。
一方面,当XA设置为OFF时,PREPARE事务只能回滚,不能提交;另一方面,要保证Binlog/Engine failure recovery的数据一致性。
删除此参数后,XA将默认启用。

WL#8894: InnoDB: Remove deprecated parameter innodb_locks_unsafe_for_binlog
与上面一样,参数innodb_locks_unsafe_for_binlog在MySQL 5.6中被标记为弃用,并从MySQL 8.0的代码中删除。
(参数的指令文件。但是,我想在正常情况下没有人会设置它。)

WL#9071: Remove mysql_install_db and server — bootstrap option
删除mysql_install_db,并删除mysqld的引导参数。将来,要安装实例,您需要使用mysqld - initialize

WL#9014: Deprecate and remove mysql_shutdown()
删除C代码中API mysql_shutdown,删除命令类型COM_SHUTDOWN .COM_SHUTDOWN

WL#9091: Remove — ssl, — ssl-verify-server-cert client-side options
删除- ssl、- ssl-verify-server-cert客户端选项。将来,您可以使用WL#8785实现的- ssl模式选项。

参考
https://www.alibabacloud.com/blog/New-in-MySQL-8-0---the-Vanishing-Parameters-Features_p68895?spm=a2c41.11121836.0.

 

二、mysql出现Specified key was too long

      通常解决办法是Myisam 引擎修改未INnoDb

三、字节计算方式:

    

UTF8 is multi-bytes, and key length is calculated in this way - 500 * 3 * 6 = 9000 bytes.

utf8mb4 is multi-bytes, and key length is calculated in this way - 500 * 4 * 6 = 9000 bytes.

But note, next query works!

CREATE TABLE IF NOT EXISTS test_table1 (
  column1 varchar(500) NOT NULL,
  column2 varchar(500) NOT NULL,
  column3 varchar(500) NOT NULL,
  column4 varchar(500) NOT NULL,
  column5 varchar(500) NOT NULL,
  column6 varchar(500) NOT NULL,
  KEY `index` (column1, column2, column3, column4, column5, column6)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

  

①启用innodb_large_prefix参数能够取消对于索引中每列长度的限制(但是无法取消对于索引总长度的限制)

②启用innodb_large_prefix必须同时指定innodb_file_format=barracuda,innodb_file_per_table=true,并且建表的时候指定表的row_format为dynamic或者compressed(mysql 5.6中row_format默认值为compact)

四、mysql8.0 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored 

     

1、终极解决方案:
    my.ini中添加 innodb_strict_mode   = 0  针对Innodb引擎
2、官方解释:
    https://dev.mysql.com/doc/search/?d=201&p=1&q=Row+size+too+large
https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html#row-size-limits

https://dev.mysql.com/doc/refman/8.0/en/innodb-limits.html

https://dev.mysql.com/doc/refman/8.0/en/innodb-row-format.html

https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_page_size

   

 

 

 

 MariaDb 给出的官方解释:

 Troubleshooting Row Size Too Large Errors with InnoDB - MariaDB Knowledge Base 

  

 

 

 

 

 

 

 

 

 

 

 

     sdf

posted on 2021-11-26 18:37  bug_x  阅读(737)  评论(0编辑  收藏  举报