如何升级到MySQL8.0

时间:2021-05-02 21:59:28   收藏:0   阅读:43

为什么要升级到MySQL8.0

  1. 基于安全考虑
  2. 基于性能和稳定性考虑
  3. 新的功能
  4. 原始环境中版本太多,统一版本

升级检查需要做什么

schema:mysql、 information_schema、 performance_schema、 sys

https://dev.mysql.com/doc/refman/8.0/en/keywords.html

Group by 处理上的不兼容

  • 需要考虑回滚方案
  • 兼容老的配置
  • 不兼容的操作方法,影响复制(grant user)
  • 希望是一个平稳的过渡,例如先升级一个从库,到所有从库
  • 最少停机时间
  • grant-->create user,grant / old_password
  • 更改用户权限 MySQL 8.0 只支持 alter user
  • flush query cache
  • Set @@global.sql_log_bin

利用MySQL Shell做升级检查

./mysqlsh root@127.0.0.1:3311 -e "util.checkForServerUpgrade();"

升级到MySQL8.0的正确步骤

8.0以前正常升级步骤
  1. 关闭MySQL
  2. 备份原来MySQL的datadir
  3. 更改MySQL server版本
  4. 备份my.cnf并做兼容8.0处理
  5. 启动MySQL(--skip-grant-tables)
  6. 运行mysql_upgrade
  7. 重启MySQL
MySQL 8.0升级流程
  1. 关闭MySQL
  2. 备份原来MySQL的datadir
  3. 更改MySQL server版本
  4. 备份my.cnf并做兼容8.0处理
  5. 启动MySQL(自动升级)

新的选型 --upgrade

启动并查看日志更新过程
[root@study01 4444]# cat /dev/null > mysql-error.log 
[root@study01 4444]# cat mysql-error.log 
[root@study01 4444]# tailf mysql-error.log 
...
tarting upgrade of data directory.
InnoDB initialization has started.
InnoDB initialization has ended.
X Plugin ready for connections. Bind-address: ‘::‘ port: 33060, socket: /tmp/mysqlx.sock
Finished populating Data Dictionary tables with data.
Server upgrade from ‘50700‘ to ‘80021‘ started.
Server upgrade from ‘50700‘ to ‘80021‘ completed.

MySQL 8.0升级总结

降低风险
快速的升级流程
8.0的升级自动化升级了help tables

因为有悔,所以披星戴月;因为有梦,所以奋不顾身! 个人博客首发:easydb.net 微信公众号:easydb 关注我,不走丢!

技术分享图片

原文:https://www.cnblogs.com/easydb/p/14725944.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!