MySQL Shell提供了一套工具集,用户可以利用这套工具集完成不同的MySQL 任务。在这一篇文章里,将为读者介绍升级检查器。
用户可以使用升级检查器来检查MySQL 5.7服务器实例,以及MySQL 8.0服务器实例与最新MySQL 8.0版本的兼容性错误和升级问题。在这里再次强调一下,使用MySQL 5.7的用户,你的MySQL该升级了。按照目前制定的产品生命周期计划,MySQL 5.7在明年10月份之后不再提供任何补丁代码,届时如果遇到安全问题,将会影响到系统的安全性。
升级检查器可以检查服务器实例的配置文件(my.cnf或my.ini)。如果存在现有的配置文件中已经定义,但在目标服务器版本中被删除的任何系统变量,或者现有的配置文件中没有定义,但在目标MySQL服务器版本中具有不同默认值的任何系统变量。升级检查器将列出相关信息。
升级检查器可以生成默认格式的输出,也可以生成JSON格式的输出,使用JSON格式可能更容易进行自动化的解析和处理。
使用该工具时,只需在MySQL Shell中执行:
util.checkForServerUpgrade (ConnectionData connectionData, Dictionary options)
复制
注意选项部分,第一个选项用于提供连接至MySQL实例的信息,第二个选项以字典的形式提供,包括目标版本、配置路径及输出格式等内容。
举一个例子:
MySQL localhost:3310 ssl JS > util.checkForServerUpgrade('root@localhost:3310',{"targetVersion":"8.0.28"})
The MySQL server at localhost:3310, version 8.0.20 - MySQL Community Server -
GPL, will now be checked for compatibility issues for upgrade to MySQL 8.0.28...
1) Issues reported by 'check table x for upgrade' command
No issues found
Errors: 0
Warnings: 0
Notices: 0
No known compatibility errors or issues were found.
复制
可以看到,从8.0.20升级至8.0.28是不存在不兼容现象的。
再举一个5.7的🌰:
MySQL localhost:3306 JS > util.checkForServerUpgrade('root@localhost:3306',{"targetVersion":"8.0.28"})
Please provide the password for 'root@localhost:3306': ****
Save password for 'root@localhost:3306'? [Y]es/[N]o/Ne[v]er (default No): y
The MySQL server at localhost:3306, version 5.7.18-log - MySQL Community Server
(GPL), will now be checked for compatibility issues for upgrade to MySQL
8.0.28...
1) Usage of old temporal type
No issues found
2) Usage of db objects with names conflicting with new reserved keywords
No issues found
3) Usage of utf8mb3 charset
No issues found
4) Table names in the mysql schema conflicting with new tables in 8.0
No issues found
5) Partitioned tables using engines with non native partitioning
No issues found
6) Foreign key constraint names longer than 64 characters
No issues found
7) Usage of obsolete MAXDB sql_mode flag
No issues found
8) Usage of obsolete sql_mode flags
Notice: The following DB objects have obsolete options persisted for
sql_mode, which will be cleared during upgrade to 8.0.
More information:
https://dev.mysql.com/doc/refman/8.0/en/mysql-nutshell.html#mysql-nutshell-removals
global system variable sql_mode - defined using obsolete NO_AUTO_CREATE_USER
option
9) ENUM/SET column definitions containing elements longer than 255 characters
No issues found
10) Usage of partitioned tables in shared tablespaces
No issues found
11) Circular directory references in tablespace data file paths
No issues found
12) Usage of removed functions
No issues found
13) Usage of removed GROUP BY ASC/DESC syntax
No issues found
14) Removed system variables for error logging to the system log configuration
To run this check requires full path to MySQL server configuration file to be specified at 'configPath' key of options dictionary
More information:
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-13.html#mysqld-8-0-13-logging
15) Removed system variables
To run this check requires full path to MySQL server configuration file to be specified at 'configPath' key of options dictionary
More information:
https://dev.mysql.com/doc/refman/8.0/en/added-deprecated-removed.html#optvars-removed
16) System variables with new default values
To run this check requires full path to MySQL server configuration file to be specified at 'configPath' key of options dictionary
More information:
https://mysqlserverteam.com/new-defaults-in-mysql-8-0/
17) Zero Date, Datetime, and Timestamp values
No issues found
18) Schema inconsistencies resulting from file removal or corruption
No issues found
19) Tables recognized by InnoDB that belong to a different engine
No issues found
20) Issues reported by 'check table x for upgrade' command
No issues found
21) New default authentication plugin considerations
Warning: The new default authentication plugin 'caching_sha2_password' offers
more secure password hashing than previously used 'mysql_native_password'
(and consequent improved client connection authentication). However, it also
has compatibility implications that may affect existing MySQL installations.
If your MySQL installation must serve pre-8.0 clients and you encounter
compatibility issues after upgrading, the simplest way to address those
issues is to reconfigure the server to revert to the previous default
authentication plugin (mysql_native_password). For example, use these lines
in the server option file:
[mysqld]
default_authentication_plugin=mysql_native_password
However, the setting should be viewed as temporary, not as a long term or
permanent solution, because it causes new accounts created with the setting
in effect to forego the improved authentication security.
If you are using replication please take time to understand how the
authentication plugin changes may impact you.
More information:
https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password-compatibility-issues
https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password-replication
Errors: 0
Warnings: 1
Notices: 1
No fatal errors were found that would prevent an upgrade, but some potential issues were detected. Please ensure that the reported issues are not significant before upgrading.
复制
从输出报告可以看出,升级检查器在21个方面进行了检查,最终得出一个警告信息和一个提示。
通过以上的例子,读者可以发现,MySQL Shell提供的升级检查工具能够帮助用户检测版本兼容性,减轻升级工作负担。
感谢您关注“MySQL解决方案工程师”!
文章转载自MySQL解决方案工程师,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【MySQL 30周年庆】MySQL 8.0 OCP考试限时免费!教你免费领考券
墨天轮小教习
2526次阅读
2025-04-25 18:53:11
MySQL 30 周年庆!MySQL 8.4 认证免费考!这次是认真的。。。
严少安
781次阅读
2025-04-25 15:30:58
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
438次阅读
2025-04-17 17:02:24
MySQL 9.3 正式 GA,我却大失所望,新特性亮点与隐忧并存?
JiekeXu
407次阅读
2025-04-15 23:49:58
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
366次阅读
2025-04-15 14:48:05
openHalo问世,全球首款基于PostgreSQL兼容MySQL协议的国产开源数据库
严少安
356次阅读
2025-04-07 12:14:29
记录MySQL数据库的一些奇怪的迁移需求!
陈举超
262次阅读
2025-04-15 15:27:53
MySQL 8.0 OCP 1Z0-908 考试解析指南(二)
JiekeXu
216次阅读
2025-04-30 17:37:37
MySQL 8.4 新特性深度解析:功能增强、废弃项与移除项全指南
JiekeXu
210次阅读
2025-04-18 20:21:32
GreatSQL 新版发布:MySQL 牵手“鸭子”
严少安
146次阅读
2025-04-19 14:57:56