跳转到主要内容

MySQL从5.7.21升级到8.0.11的更新之路

MySQL从5.7.21升级到8.0.11

my.cnf配置的一些关健点,说明一下

Symbolic links现在默认就是禁用了,无需再去标记禁用了,如果你标记的话,会有个提醒:

'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.

再有就是“expire-logs-days”参数已经没有了,取而代之的是“binlog_expire_logs_seconds”,如名,单位是秒,不要搞错了。

据说,purge方式也不一样,但我没细究,回头看看。错误提示如下:

The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.

SQL Mode的NO_AUTO_CREATE_USER也没有了。

In MySQL 8.0.11, several deprecated features related to account management have been removed, such as use of the GRANT statement to modify nonprivilege characteristics of user accounts, the NO_AUTO_CREATE_USER SQL mode, the PASSWORD() function, and the old_passwords system variable.

Using GRANT to create users. Instead, use CREATE USER. Following this practice makes the NO_AUTO_CREATE_USER SQL mode immaterial for GRANT statements, so it too is removed.

实际应用时,发现不用加密手段,根本登录不上MySQL(比如用phpMyAdmin等就不行,用命令行就没事)。

查了下,发现是MySQL 8.0改了默认加密方式为“caching_sha2_password”:

In MySQL 8.0, caching_sha2_password is the default authentication plugin rather than mysql_native_password.

咋整?那就改回来呗,改回“mysql_native_password”。

default_authentication_plugin=mysql_native_password

另外MySQL的X Plugin默认跟随启动,作用我还没具体了解,早在5.7就有了,但一直没用它。

跟随启动后,如果你是用socket,它会在相同目录生成mysqlx.sock。并且他的连接方式强制要SSL,至少第一次要,如果我没理解错,官方是这么写的:

This means that the first use of an account must be done using an SSL connection with the X Plugin authentication cache enabled. Once this initial authentication over SSL has succeeded non-SSL connections can be used.

所以你也能在日志文件看到告警,如果你没有配置SSL的话:

Plugin mysqlx reported: 'Failed at SSL configuration: "SSL context is not usable without certificate and private key"

文档虽说mysqlx-ssl与ssl相等,但mysqlx-ssl=0或者skip、disabled都没用。并无办法禁用这一警告,如果谁知道方法和文档位置,麻烦告知下,谢谢。

而且这个的实际应用能有多少,也是个疑问。

之前说MySQL已经不用MyISAM存储了。确实没错,核心引擎已经不再使用MyISAM了,改为InnoDB了。但MyISAM引擎仍然是可用的,但是有限支持,具体可以看文档,传送门

In MySQL 8.0, it is normally necessary to use ENGINE to specify the MyISAM storage engine because InnoDB is the default engine.

In MySQL 8.0, the MyISAM storage engine provides no partitioning support. Partitioned MyISAM tables created in previous versions of MySQL cannot be used in MySQL 8.0. For more information, see Section 23.6.2, “Partitioning Limitations Relating to Storage Engines”.

其实想知道MySQL怎么禁用MyISAM这些插件,像MariaDB很容易禁用,给MySQL配上禁用参数,只会提示不认识这个参数。。

还有现在utf8mb4默认编码使用的是utf8mb4_0900_ai_ci,据说有优化,先用着看看有没有坑吧。。。

十分推荐升级,性能和效率提升很多。其他坑暂时没遇到过,正在尝试调优。

好了,就先简单说到这,其他需要补充的,后续再补充。

MySQL 8.0之前的版本,当使用--all-databases 参数导出数据的时候,不加--routines和--events选项也可以导出触发器、存储过程等信息,因为这些信息都存放于proc和event表中,导出所有表即可导出这些信息。

但是在MySQL 8.0中,proc表和event表都不再使用,并且定义触发器、存储过程的数据字典表不会被导出。所以在8.0中使用mysqldump、mysqlpump导出数据的时候,如果需要导出触发器、存储过程等内容,一定需要加上--routines和--events选项。

  •