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