mysql升级
升级路径:
MYSQL 5.6 --> MySQL 5.7 --> MySQL8.0.x
MySQL 5.7 GA release (5.7.9 or higher) - MySQL8.0.x
MySQL 8.0.x to 8.0.y
MySQL 8.0.x to 8.0.z
不支持非GA版本的升级到MySQL 8.0
从MySQL 8.0.16 开始,MySQL不推荐使用mysql_upgrade。取而代之的是server upgrade的升级方式。
升级过程
MySQL 8.0.16之前:
1.关闭 MySQL,替换新的二进制 MySQL
2.启动 MySQL,让服务器升级 DD(数据字典)表
3.运行 mysql_upgrade,更新系统表和用户表
4.加载新的帮助表
5.重启 MySQL
MySQL 8.0.16之后:
1.关闭 MySQL,替换新的二进制 MySQL
2.启动 MySQL,升级 DD(数据字典)表和系统表、用户表和帮助表
本次验证升级从mysql8.0.18 升级到最新版的mysql8.0.25
环境:
mysql版本:mysql 8.0.18
部署方式是:二进制解压安装
架构:一主一从复制(开启gtid复制)
升级前检查:
下载安装一个mysqlshell工具执行util.checkForServerUpgrade()
checkForServerUpgrade (ConnectionData connectionData, Dictionary options)
util.checkForServerUpgrade('user@example.com:3306', {"password":"password", "targetVersion":"8.0.11", "configPath":"C:\ProgramData\MySQL\MySQL Server 8.0\my.ini"})
8.0.18 升级到 8.0.25检查:
MySQL 10.1.1.13:3306 ssl JS > util.checkForServerUpgrade()
The MySQL server at 10.1.1.13:3306, version 8.0.18 - MySQL Community Server -
GPL, will now be checked for compatibility issues for upgrade to MySQL 8.0.25...
1) Issues reported by 'check table x for upgrade' command
No issues found
Errors: 0
Warnings: 0
Notices: 0
5.7.26 升级到8.0.25 检查:
MySQL 10.1.1.14:3308 JS > util.checkForServerUpgrade()
The MySQL server at 10.1.1.14:3308, version 5.7.26-log - MySQL Community Server
(GPL), will now be checked for compatibility issues for upgrade to MySQL
8.0.25...
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.
MySQL 10.1.1.14:3308 JS >
对检查发现的问题进行修正
2.根据需要确定是否需要修改配置文件配置项,目前环境不需要做任何修改
3.下载最新版本的二进制包,并解压,修改属主属组
cd /usr/local
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz
解压:
tar -Jxvf mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz
chown 权限
chown mysql:mysql -R /usr/local/mysql-8.0.25-linux-glibc2.12-x86_64
4.先升级slave 停止复制,停止数据库实例
mysql> stop slave;
mysql> shutdown
5.删除原来老版本的mysql软链接,然后链接新版本的mysql上
cd /usr/local
rm -rf mysql
ln -s /usr/local/mysql-8.0.25-linux-glibc2.12-x86_64 mysql
6.启动数据库
/usr/local/mysql8018/bin/mysqld --defaults-file=/home/my3306.cnf --user=mysql &
7.检查error日志
2021-06-28T04:28:21.864893-04:00 1 [Note] [MY-012976] [InnoDB] 8.0.25 started; log sequence number 20126176
2021-06-28T04:28:21.876704-04:00 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-06-28T04:28:21.901950-04:00 1 [System] [MY-011090] [Server] Data dictionary upgrading from version '80017' to '80023'.
2021-06-28T04:28:21.924913-04:00 1 [Note] [MY-013327] [Server] MySQL server upgrading from version '80018' to '80025'.
2021-06-28T04:28:22.112061-04:00 1 [Note] [MY-012357] [InnoDB] Reading DD tablespace files
2021-06-28T04:28:22.113231-04:00 1 [Note] [MY-012356] [InnoDB] Scanned 6 tablespaces. Validated 6.
2021-06-28T04:28:22.738032-04:00 1 [System] [MY-013413] [Server] Data dictionary upgrade from version '80017' to '80023' completed.
2021-06-28T04:28:22.752008-04:00 1 [Note] [MY-013327] [Server] MySQL server upgrading from version '80018' to '80025'.
2021-06-28T04:28:22.907422-04:00 1 [Note] [MY-010006] [Server] Using data dictionary with version '80023'.
2021-06-28T04:28:22.917070-04:00 0 [Note] [MY-011332] [Server] Plugin mysqlx reported: 'IPv6 is available'
2021-06-28T04:28:22.917732-04:00 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. bind-address: '::' port: 33060'
2021-06-28T04:28:22.917943-04:00 0 [Note] [MY-011323] [Server] Plugin mysqlx reported: 'X Plugin ready for connections. socket: '/tmp/mysqlx.sock''
2021-06-28T04:28:22.918153-04:00 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /tmp/mysqlx.sock
2021-06-28T04:28:24.728769-04:00 4 [System] [MY-013381] [Server] Server upgrade from '80018' to '80025' started.
2021-06-28T04:28:24.730175-04:00 4 [Note] [MY-013386] [Server] Running queries to upgrade MySQL server.
8.连接升级后的数据检查mysql版本
select version();
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.25 |
+-----------+
9.按照同样方式升级主库,并启动复制
10.测试业务跑基本的流程
11.升级备份工具,已进行新版本的备份
升级xtrabackup工具到8.0.25-17
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。