专栏首页mysql-dbamysql升级到最新版(mysql8.0.25)
原创

mysql升级到最新版(mysql8.0.25)

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

原创声明,本文系作者授权云+社区发表,未经许可,不得转载。

如有侵权,请联系 yunjia_community@tencent.com 删除。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • OpenSSH升级版本到最新(8.4)

    1.修改#PermitRootLogin prohibit-password项,去掉注释#并把prohibit-password改为yes,修改后即为Permi...

    硅谷子
  • OpenSSL升级版本到最新(1.1.1)

    执行make && make install耐心等待即可直至完成。然后再次执行openssl version 查看会发现还是OpenSSL 1.0.2k-fip...

    硅谷子
  • MySQL MGR监控中遇到的字符集Illegal mix of collations

    ProxySQL整合MGR提供高可用,是我们知数堂课程中提供一个MySQL高可用的解决方案,架构如下:

    wubx
  • 如何将Ubuntu升级到18.04最新版

    Ubuntu操作系统的最新长期支持(LTS)版本Ubuntu 18.04(Bionic Beaver)于2018年4月26日发布。本教程将讲解如何将16.04或...

    挺问中原
  • PHPCMS编辑器ckeditor升级到最新版

    从官方网站下载需要的版本,一般都选择标准版。ckeditor官方下载地址 http://ckeditor.com/download 找到PHPCMS放ckedi...

    李维亮
  • 如何升级到最新LTS版本SonarQube 7.9.1 ?

    写个for循环,循环执行。执行两次该脚本(因第一次分析的时候没有缺陷会不显示数据)

    DevOps云学堂
  • centos7升级curl到最新版,升级失败后如何回退

    rpm -ivh http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-...

    shawyang
  • 半同步复制搭建过程

    半同步复制需要安装额外插件之后才能启用,然后通过相应的变量启用,在安装插件之前这些变量不可用

    wangwei-dba
  • CentOS7升级最新版本Docker

    kongxx
  • 58到家MySQL军规升级版

    一、基础规范 表存储引擎必须使用InnoDB 表字符集默认使用utf8,必要时候使用utf8mb4 解读: (1)通用,无乱码风险,汉字3字节,英文1字节 (...

    架构师之路
  • 博客系统升级到最新版,记录一下

    过去的这个春节假期,母亲来上海过年,我把固定年假提前休掉了,除了品尝到母亲亲手制作的家乡美食外,整理了一下QQ空间(准确的说应该是整理了一下QQ相册),抄写了一...

    崔文远TroyCui
  • mysql官网下载最新版升级版本多版本安装教程

    用户2235302
  • mysql官网下载最新版升级版本多版本安装教程

    码农笔录
  • CentOS 7使用elrepo源升级内核到最新版本

    [root@localhost ~]# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

    天天向上_82634
  • 【转载】58到家MySQL军规升级版

    (1)对数据库性能影响较大,互联网业务,能让站点层和服务层干的事情,不要交到数据库层

    二狗不要跑
  • Mysql 军规升级版

    北漂的我
  • Xshell 被植入后门 请尽快升级到最新版本

    魏艾斯博客www.vpsss.net
  • Centos升级系统到最新内核

    繁花云
  • 微软win10易升工具——win10升级最新1909版!

    相信有平常注意电脑更新的童鞋已经看到了你的win10电脑已经开始提醒你更新版本了,大家可以按如下打开查看电脑是否有提醒更新:

    FreeRonin

扫码关注云+社区

领取腾讯云代金券