当前MySQL版本为:5.7.21

升级前准备,了解5.7和8.0版本有何区别,本文主要为升级操作文档,具体建议参考官方文档,概括性的有以下几点:

》默认字符集由latin1变为utf8mb4

》支持隐藏索引,索引可以被隐藏和显示

》用户创建,修改和授权

》sql_mode参数默认值变化

》支持窗口函数等

》sql_mode参数默认值变化

以下为升级8.0需要配置文件中新增的参数配置

#for8.0
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
character-set-server = utf8mb4
collation_server = utf8mb4_general_ci
basedir = /home/mysql8
skip_ssl
default_authentication_plugin=mysql_native_password

环境说明:我是本机部署了两个mysql 实例,分别为3306和3307,3306为主节点

首先升级实例3307 (从库)

[root@localhost mysql]# ./bin/mysql -uroot -p -S /home/mysql/3307/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21-log MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show variables like 'innodb_fast_shutdown';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1 |
+----------------------+-------+
1 row in set (0.01 sec) mysql> set global innodb_fast_shutdown=0;
Query OK, 0 rows affected (0.00 sec)
mysql> shutdown;
mysql> exit
Bye
[root@localhost mysql8]# cd /home/mysql8
[root@localhost mysql8]# ./bin/mysqld_safe --defaults-file=/home/mysql/3307/my.cnf &

登录重新查看版本以及主从情况和数据

[root@localhost mysql]# ./bin/mysql -uroot -p -S /home/mysql/3307/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.30 MySQL Community Server - GPL Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.30 |
+-----------+
1 row in set (0.01 sec) mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.01 sec) mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.53.123
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000007
Read_Master_Log_Pos: 154
Relay_Log_File: relay-log.000011
Relay_Log_Pos: 370
Relay_Master_Log_File: mysql-bin.000007
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
... ...

升级完成,3306实例主库操作同上

升级过程错误汇总:

1、启动失败,提示信息如下

经对 msyqld_safe 启动文件查看发现变量MY_PWD=`pwd`,执行启动得时候不能使用绝对路径,此变量需要获取当前路径,先进入mysql8 目录下执行./msyqld_safe --defaults-file="配置文件" 及恢复正常

如下信息说明现在启动后得配置文件使用得即为指定得配置文件

2、启动报错,日志如下图,此报错说设置utf8_general_ci设置utf8mb4,修改配置文件

3、启动报错,根据日志错误提示mysql5.7.21不支持innodb_dast_shutdown = 2 得时候升级

最新文章

  1. C#中的委托解析
  2. Pdf 字段加粗相关资料
  3. 深入理解计算机系统第二版习题解答CSAPP 2.16
  4. 二层安全之MAC Flooding解析与解决方法
  5. 高效JQuery编码
  6. struts2的注解配置全面解析
  7. LeetCode OJ 45. Jump Game II
  8. 一步一步学J2SE-HashMap的实现原理
  9. mysql 与 oracle 的时间查询
  10. Linux安装Redis和Redis基本操作命令
  11. shell脚本第一课
  12. path变量修改后无法保存
  13. 如何优化JAVA代码
  14. 原创:微信小程序调用PHP后台接口,解析纯html文本
  15. PAT 1012 数字分类 C语言
  16. Python用户交互-密码不可见
  17. ThreadPoolExecutor中策略的选择与工作队列的选择(java线程池)
  18. Windows 2012 Server评估版本安装问题处理
  19. Python basic (from learn python the hard the way)
  20. go——结构体(二)

热门文章

  1. 前段知识之CSS
  2. jmeter 之性能分布式压测
  3. Go语言与其他高级语言的区别
  4. 【进阶篇】Redis实战之Jedis使用技巧详解
  5. Centos7下git最新版本安装
  6. [seaborn] seaborn学习笔记11-绘图实例(3) Drawing example(3)
  7. CSS 奇思妙想之酷炫倒影
  8. Java学习笔记:2021年12月31日下午-2022年1月1日上午
  9. 如何通过Java应用程序将 PDF转为Word文档
  10. 保姆级手把手图文并茂教你配置MAC系统Flutter环境