通过yum:mysql5.6-msyql5.7-mysql8.0升级之路

news2024/12/22 22:38:50

一 前言

mysql的yum源

https://dev.mysql.com/downloads/repo/yum/
https://dev.mysql.com/get/mysq57-community-release-el7-7.noarch.rpm

服务器信息

2c2g40GB
[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# uname -a
Linux bogon 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

二 安装mysql5.6

1 卸载mysql,mariadb

[root@localhost ~]# rpm -qa|grep -i mariadb
mariadb-libs-5.5.68-1.el7.x86_64
mariadb-devel-5.5.68-1.el7.x86_64
[root@localhost ~]# rpm -qa | grep mysql
[root@localhost ~]# rpm -qa|grep mariadb|xargs rpm -e --nodeps

2查看mysql可用的下载

[root@localhost ~]# yum repolist all | grep mysql
mysql-connectors-community/x86_64 MySQL Connectors Community        启用:    178
mysql-connectors-community-source MySQL Connectors Community - Sour 禁用
mysql-tools-community/x86_64      MySQL Tools Community             启用:     83
mysql-tools-community-source      MySQL Tools Community - Source    禁用
mysql55-community/x86_64          MySQL 5.5 Community Server        禁用
mysql55-community-source          MySQL 5.5 Community Server - Sour 禁用
mysql56-community/x86_64          MySQL 5.6 Community Server        启用:    644
mysql56-community-source          MySQL 5.6 Community Server - Sour 禁用
mysql57-community-dmr/x86_64      MySQL 5.7 Community Server Develo 禁用
mysql57-community-dmr-source      MySQL 5.7 Community Server Develo 禁用

3指定版本安装

#命令包
yum -y install yum-utils 


禁用 mysql8.0:
yum-config-manager --disable mysql80-community

启用mysql 5.6
yum-config-manager --enable mysql56-community

4安装

[root@localhost ~]# yum install mysql-server

[root@localhost tmp]# rpm -qa | grep mysql
mysql-community-server-5.6.51-2.el6.x86_64
mysql80-community-release-el7-7.noarch
mysql-community-client-5.6.51-2.el6.x86_64
mysql-community-libs-5.6.51-2.el6.x86_64
mysql-community-common-5.6.51-2.el6.x86_64

在这里插入图片描述

5my.cnf的配置,尽量环境一致,字符集必须指定,在实际环境中mysql8.0字符集也被改了(utf-8)

[root@localhost ~]# cat /etc/my.cnf
#For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
[mysqld]
collation-server=utf8_general_ci
character-set-server=utf8
#max_connections                =1000
#default-storage-engine=MYISAM
#default-tmp-storage-engine=MYISAM

#AFETY #
max-allowed-packet             = 16M
max-connect-errors             = 1000
lower_case_table_names         = 1
# INNODB #
innodb-flush-method            = O_DIRECT
innodb-log-files-in-group      = 2
innodb-log-file-size           = 64M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table          = 1
innodb-buffer-pool-size        = 150M
max-allowed-packet             = 16M
max-connect-errors             = 1000
lower_case_table_names         = 1
# # CACHES AND LIMITS #
tmp-table-size                 = 32M
max-heap-table-size            = 32M
query-cache-type               = 0
query-cache-size               = 0
max-connections                = 1000
thread-cache-size              = 50
open-files-limit               = 1024
performance_schema_max_table_instances= 600
table-definition-cache         = 512
table-open-cache               = 256

# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#bind=127.0.0.1
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
default-character-set=utf8

更新root密码,授权登录

[root@localhost ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.51 MySQL Community Server (GPL)

Copyright (c) 2000, 2021, 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> set password for root@localhost = password('a^X1wIKwskU0D6Li');
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to'root'@'localhost' identified by 'a^X1wIKwskU0D6Li';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to'root'@'127.0.0.1' identified by 'a^X1wIKwskU0D6Li';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to'root'@'192.168.56.%' identified by 'a^X1wIKwskU0D6Li';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


6 导入数据

在这里插入图片描述

三 从mysql5.6升级到mysql5.7

1 备份所有库,配置文件

备份的时候直接复制mysql数据存储目录(/var/lib/mysql),当然配置文件也是需要备份的,备份了旧的数据存储目录后,如果在升级时失败,好回滚

[root@bogon ~]# cp /etc/my.cnf /etc/my.cnf_20230602 
[root@bogon ~]# mysqldump -uroot -p'a^X1wIKwskU0D6Li'  --set-gtid-purged=OFF  --all-databases > /opt/mysqlbackup_20230602.bak
Warning: Using a password on the command line interface can be insecure.
[root@bogon ~]# du -sh /opt/mysqlbackup_20230602.bak 
64M	/opt/mysqlbackup_20230602.bak
#或者
[root@bogon ~]# cp -r /var/lib/mysql /var/lib/mysql_20230602

2.停止mysql服务

1通过与数据库的交互页面关闭,确保数据最大写入磁盘

[root@bogon ~]# mysql -u root -p'a^X1wIKwskU0D6Li'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.51 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> 
mysql> 
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.51   |
+-----------+
1 row in set (0.01 sec)

mysql> show variables like 'innodb_fast_shutdown';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1     |
+----------------------+-------+
1 row in set (0.01 sec)

#确保数据都刷到硬盘上,更改成0
mysql> set global innodb_fast_shutdown=0;
Query OK, 0 rows affected (0.00 sec)

mysql> shutdown;
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> 
mysql> 
mysql> exit
Bye
[root@bogon ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      998/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1186/master         
tcp6       0      0 :::22                   :::*                    LISTEN      998/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1186/master   

innodb_fast_shutdown
使用场景:在做数据库关闭升级的时候 set global innodb_fast_shutdown=0,这个时候能最大保障数据的完整性。
设置为1:关闭MySQL的时候不会做清除脏页和插入缓冲区的合并操作,也不会将脏页刷新到磁盘
设置为0:会做清除脏页和插入缓冲区的合并操作,也会将脏页全部刷新到磁盘上面去,但是这个时候关闭的速度也是最慢的
设置为2:不会做清除脏页和插入缓冲区的合并操作,也不会将脏页刷新到磁盘,但是会刷新到redo log里面,再下次启动mysql的时候恢复

2直接关闭

systemctl stop mysqld
[root@bogon ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      998/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1186/master         
tcp6       0      0 :::22                   :::*                    LISTEN      998/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1186/master    

3开启mysql5.7版本

[root@bogon ~]# yum-config-manager --disable mysql56-community
[root@bogon ~]# yum-config-manager --enable mysql57-community

上述命令修改失败

yum 源的问题 ,删除旧的源,安装新的源即可

https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm

rpm  -h mysql80-community-release-el7-7.noarch.rpm

[root@bogon ~]# yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64           MySQL Cluster 7.5 Comm 禁用
mysql-cluster-7.5-community-source           MySQL Cluster 7.5 Comm 禁用
mysql-cluster-7.6-community/x86_64           MySQL Cluster 7.6 Comm 禁用
mysql-cluster-7.6-community-source           MySQL Cluster 7.6 Comm 禁用
mysql-cluster-8.0-community/x86_64           MySQL Cluster 8.0 Comm 禁用
mysql-cluster-8.0-community-debuginfo/x86_64 MySQL Cluster 8.0 Comm 禁用
mysql-cluster-8.0-community-source           MySQL Cluster 8.0 Comm 禁用
mysql-connectors-community/x86_64            MySQL Connectors Commu 启用:    178
mysql-connectors-community-debuginfo/x86_64  MySQL Connectors Commu 禁用
mysql-connectors-community-source            MySQL Connectors Commu 禁用
mysql-tools-community/x86_64                 MySQL Tools Community  启用:     83
mysql-tools-community-debuginfo/x86_64       MySQL Tools Community  禁用
mysql-tools-community-source                 MySQL Tools Community  禁用
mysql-tools-preview/x86_64                   MySQL Tools Preview    禁用
mysql-tools-preview-source                   MySQL Tools Preview -  禁用
mysql57-community/x86_64                     MySQL 5.7 Community Se 禁用
mysql57-community-source                     MySQL 5.7 Community Se 禁用
mysql80-community/x86_64                     MySQL 8.0 Community Se 启用:    405
mysql80-community-debuginfo/x86_64           MySQL 8.0 Community Se 禁用
mysql80-community-source                     MySQL 8.0 Community Se 禁用
[root@bogon ~]#  yum-config-manager --disable mysql80-community

[root@bogon ~]# yum-config-manager --enable mysql5-community

[root@bogon ~]# yum-config-manager --enable mysql57-community


[root@bogon ~]# yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64           MySQL Cluster 7.5 Comm 禁用
mysql-cluster-7.5-community-source           MySQL Cluster 7.5 Comm 禁用
mysql-cluster-7.6-community/x86_64           MySQL Cluster 7.6 Comm 禁用
mysql-cluster-7.6-community-source           MySQL Cluster 7.6 Comm 禁用
mysql-cluster-8.0-community/x86_64           MySQL Cluster 8.0 Comm 禁用
mysql-cluster-8.0-community-debuginfo/x86_64 MySQL Cluster 8.0 Comm 禁用
mysql-cluster-8.0-community-source           MySQL Cluster 8.0 Comm 禁用
mysql-connectors-community/x86_64            MySQL Connectors Commu 启用:    220
mysql-connectors-community-debuginfo/x86_64  MySQL Connectors Commu 禁用
mysql-connectors-community-source            MySQL Connectors Commu 禁用
mysql-tools-community/x86_64                 MySQL Tools Community  启用:     98
mysql-tools-community-debuginfo/x86_64       MySQL Tools Community  禁用
mysql-tools-community-source                 MySQL Tools Community  禁用
mysql-tools-preview/x86_64                   MySQL Tools Preview    禁用
mysql-tools-preview-source                   MySQL Tools Preview -  禁用
mysql57-community/x86_64                     MySQL 5.7 Community Se 启用:    660
mysql57-community-source                     MySQL 5.7 Community Se 禁用
mysql80-community/x86_64                     MySQL 8.0 Community Se 禁用
mysql80-community-debuginfo/x86_64           MySQL 8.0 Community Se 禁用
mysql80-community-source                     MySQL 8.0 Community Se 禁用
[root@bogon ~]# 

4.升级mysql

yum update mysql-server

在这里插入图片描述
在这里插入图片描述

[root@bogon ~]# mysql -V
mysql  Ver 14.14 Distrib 5.7.42, for Linux (x86_64) using  EditLine wrapper
[root@bogon ~]# systemctl start mysqld
[root@bogon ~]# netstat -lnpt 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      998/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1186/master         
tcp6       0      0 :::3306                 :::*                    LISTEN      5743/mysqld         
tcp6       0      0 :::22                   :::*                    LISTEN      998/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1186/master    

5 更新数据库权限,并再次重新启动

[root@bogon ~]# mysql_upgrade -u root -p'a^X1wIKwskU0D6Li' --force
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database

[root@bogon ~]# systemctl restart mysqld

四 从mysql5.7升级到mysql8.0

1修改my.cnf

[root@bogon ~]# mysql -V
mysql  Ver 14.14 Distrib 5.7.42, for Linux (x86_64) using  EditLine wrapper
[root@bogon ~]# vim /etc/my.cnf
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

2备份数据

备份的时候直接复制mysql数据存储目录(/var/lib/mysql),当然配置文件也是需要备份的,备份了旧的数据存储目录后,如果在升级时失败,好回滚

[root@bogon ~]# cp /etc/my.cnf /etc/my.cnf_20230602 
[root@bogon ~]# mysqldump -uroot -p'a^X1wIKwskU0D6Li'  --set-gtid-purged=OFF  --all-databases > /opt/mysqlbackup_20230602.bak
Warning: Using a password on the command line interface can be insecure.
[root@bogon ~]# du -sh /opt/mysqlbackup_20230602.bak 
64M	/opt/mysqlbackup_20230602.bak
#或者
[root@bogon ~]# cp -r /var/lib/mysql /var/lib/mysql_20230602

3 确保数据最大写入磁盘

[root@bogon ~]# mysql -u root -p'a^X1wIKwskU0D6Li'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.42 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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> 
mysql> 
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.42    |
+-----------+
1 row in set (0.01 sec)

mysql> show variables like 'innodb_fast_shutdown';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1     |
+----------------------+-------+
1 row in set (0.01 sec)

#确保数据都刷到硬盘上,更改成0
mysql> set global innodb_fast_shutdown=0;
Query OK, 0 rows affected (0.00 sec)

mysql> shutdown;
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> 
mysql> 
mysql> exit
Bye
#mysql数据库已经停止
[root@bogon ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      998/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1186/master         
tcp6       0      0 :::22                   :::*                    LISTEN      998/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1186/master   

innodb_fast_shutdown
使用场景:在做数据库关闭升级的时候 set global innodb_fast_shutdown=0,这个时候能最大保障数据的完整性。
设置为1:关闭MySQL的时候不会做清除脏页和插入缓冲区的合并操作,也不会将脏页刷新到磁盘
设置为0:会做清除脏页和插入缓冲区的合并操作,也会将脏页全部刷新到磁盘上面去,但是这个时候关闭的速度也是最慢的
设置为2:不会做清除脏页和插入缓冲区的合并操作,也不会将脏页刷新到磁盘,但是会刷新到redo log里面,再下次启动mysql的时候恢复

4 开启mysql8.0安装

[root@bogon ~]# yum-config-manager --disable mysql57-community
[root@bogon ~]# yum-config-manager --enable mysql80-community
[root@bogon ~]# yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64           MySQL Cluster 7.5 Comm 禁用
mysql-cluster-7.5-community-source           MySQL Cluster 7.5 Comm 禁用
mysql-cluster-7.6-community/x86_64           MySQL Cluster 7.6 Comm 禁用
mysql-cluster-7.6-community-source           MySQL Cluster 7.6 Comm 禁用
mysql-cluster-8.0-community/x86_64           MySQL Cluster 8.0 Comm 禁用
mysql-cluster-8.0-community-debuginfo/x86_64 MySQL Cluster 8.0 Comm 禁用
mysql-cluster-8.0-community-source           MySQL Cluster 8.0 Comm 禁用
mysql-connectors-community/x86_64            MySQL Connectors Commu 启用:    220
mysql-connectors-community-debuginfo/x86_64  MySQL Connectors Commu 禁用
mysql-connectors-community-source            MySQL Connectors Commu 禁用
mysql-tools-community/x86_64                 MySQL Tools Community  启用:     98
mysql-tools-community-debuginfo/x86_64       MySQL Tools Community  禁用
mysql-tools-community-source                 MySQL Tools Community  禁用
mysql-tools-preview/x86_64                   MySQL Tools Preview    禁用
mysql-tools-preview-source                   MySQL Tools Preview -  禁用
mysql57-community/x86_64                     MySQL 5.7 Community Se 禁用
mysql57-community-source                     MySQL 5.7 Community Se 禁用
mysql80-community/x86_64                     MySQL 8.0 Community Se 启用:    405
mysql80-community-debuginfo/x86_64           MySQL 8.0 Community Se 禁用
mysql80-community-source                     MySQL 8.0 Community Se 禁用

5 开始升级


yum update mysql-server

在这里插入图片描述

在这里插入图片描述

1 错误1:启动失败

[root@bogon ~]# mysql -V
mysql  Ver 8.0.33 for Linux on x86_64 (MySQL Community Server - GPL)
[root@bogon ~]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.


[root@bogon ~]# tail -F  /var/log/messages 
Jun  2 13:59:14 localhost mysqld: 2023-06-02T05:59:14.630091Z 5 [System] [MY-013381] [Server] Server upgrade from '50700' to '80033' completed.
Jun  2 13:59:14 localhost mysqld: 2023-06-02T05:59:14.770369Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
Jun  2 13:59:14 localhost mysqld: 2023-06-02T05:59:14.770416Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
Jun  2 13:59:14 localhost mysqld: 2023-06-02T05:59:14.775298Z 0 [ERROR] [MY-000067] [Server] unknown variable 'query-cache-type=0'.
Jun  2 13:59:14 localhost mysqld: 2023-06-02T05:59:14.775400Z 0 [ERROR] [MY-010119] [Server] Aborting
Jun  2 13:59:19 localhost mysqld: 2023-06-02T05:59:19.405507Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.33)  MySQL Community Server - GPL.
Jun  2 13:59:19 localhost systemd: mysqld.service: main process exited, code=exited, status=1/FAILURE
Jun  2 13:59:19 localhost systemd: Failed to start MySQL Server.
Jun  2 13:59:19 localhost systemd: Unit mysqld.service entered failed state.
Jun  2 13:59:19 localhost systemd: mysqld.service failed.

MySQL8.0取消查询缓存,MySQL8.0新增加了对性能干预的工具,例如,现在可以利用查询重写插件,在不更改应用程序的同时,插入优化器提示语句。另外,还有像ProxySQL这样的第三方工具,它们可以充当中间缓存。

2 :错误1处理:修改配置文件吧

关闭下面俩个参数

vim /etc/my.cnf
#query-cache-type               = 0
#query-cache-size               = 0
[root@bogon ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      998/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1186/master         
tcp6       0      0 :::33060                :::*                    LISTEN      6614/mysqld         
tcp6       0      0 :::3306                 :::*                    LISTEN      6614/mysqld         
tcp6       0      0 :::22                   :::*                    LISTEN      998/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1186/master  

启动了2个端口3306 33306,并且日志输出到系统日志中

6 更新数据库权限,并再次重新启动

1升级表权限的时候发现已经被弃用了

[root@bogon ~]# mysql_upgrade -u root -p'a^X1wIKwskU0D6Li' --force
mysql_upgrade: [Warning] Using a password on the command line interface can be insecure.
The mysql_upgrade client is now deprecated. The actions executed by the upgrade client are now done by the server.
To upgrade, please start the new MySQL binary with the older data directory. Repairing user tables is done automatically. Restart is not required after upgrade.
The upgrade process automatically starts on running a new MySQL binary with an older data directory. To avoid accidental upgrades, please use the --upgrade=NONE option with the MySQL binary. The option --upgrade=FORCE is also provided to run the server upgrade sequence on demand.
It may be possible that the server upgrade fails due to a number of reasons. In that case, the upgrade sequence will run again during the next MySQL server start. If the server upgrade fails repeatedly, the server can be started with the --upgrade=MINIMAL option to start the server without executing the upgrade sequence, thus allowing users to manually rectify the problem.

2 数据库中查看版本

[root@bogon ~]# mysql -u root -p'a^X1wIKwskU0D6Li'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.33 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

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.33    |
+-----------+
1 row in set (0.00 sec)

mysql> show variables like 'innodb_fast_shutdown';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1     |
+----------------------+-------+
1 row in set (0.04 sec)

mysql> exit
Bye

7 其他问题 主要是字符集

参考看看
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-1.html
在这里插入图片描述

1更新mysql的字符集为utf8mb4

[root@localhost ~]# vim /etc/my.cnf

[mysqld]
character_set_server=utf8mb4
[client]
default-character-set=utf8mb4

改完重启就报错

在这里插入图片描述

2还是改回utf-8

[root@localhost ~]# vim /etc/my.cnf

#character_set_server=utf8mb4
character-set-server=utf8
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION


[client]
default-character-set=utf8
#default-character-set=utf8mb4

在这里插入图片描述

五 mysql-shell

下载地址
https://dev.mysql.com/downloads/shell/

https://dev.mysql.com/doc/mysql-shell/8.0/en/
配置yum源直接下载即可

[root@bogon ~]# rpm -qa | grep mysql
mysql-community-client-plugins-8.0.33-1.el7.x86_64
mysql-community-icu-data-files-8.0.33-1.el7.x86_64
mysql80-community-release-el7-7.noarch
mysql-community-common-8.0.33-1.el7.x86_64
mysql-community-libs-compat-5.7.42-1.el7.x86_64
mysql-community-client-8.0.33-1.el7.x86_64
mysql-community-server-8.0.33-1.el7.x86_64
mysql-community-libs-8.0.33-1.el7.x86_64
[root@bogon ~]# yum install mysql-shell-8.0.33

注意事项
https://www.cnblogs.com/zhouwanchun/p/13141682.html

MySQL 5.6升级到MySQL 5.7都有什么注意事项?


一、升级方式
MySQL升级的方式一般来说有两种
1、通过inplace方式原地升级,升级系统表
2、通过新建实例,高版本作为低版本的从库进行滚动升级

MySQL5.7版本做了非常多的改变,升级5.6到5.7时需要考虑兼容性,避免升级到5.7之后因为种种参数设置不正确导致业务受影响,建议首先逐一查看release note


二、需要注意的参数及问题:
1、sql_mode:MySQL 5.7采用严格模式,例如ONLY_FULL_GROUP_BY等
2、innodb_status_output_locks:MySQL 5.7支持将死锁信息打印到error log(其实这个参数MySQL 5.6就已支持)
3、innodb_page_cleaners:MySQL 5.7将脏页刷新线程从master线程独立出来了,对应参数为innodb_page_cleaners
4、innodb_strict_mode:控制CREATE TABLE, ALTER TABLE, CREATE INDEX, 和 OPTIMIZE TABLE的语法问题
5、show_compatibility_56=ON:控制show变量及状态信息输出,如果未开启show status 命令无法获取Slave_xxx 的状态
6、log_timestamps:控制error log/slow_log/genera log日志的显示时间,该参数可以设置为:UTC 和 SYSTEM,但是默认使用 UTC
7、disable_partition_engine_check:在表多的情况下可能导致启动非常慢
8、range_optimizer_max_mem_size:范围查询优化参数,这个参数限制范围查询优化使用的内存,默认8M
9、MySQL 5.7新增优化器选项derived_merge=on,可能导致SQL全表扫描,而在MySQL 5.6下可能表现为auto key
10、innodb_undo_directory && innodb_undo_logs:MySQL 5.7支持将undo从ibdata1独立出来(只支持实例初始化,不支持在线变更)
11、主从复制问题:MySQL5.7到小于5.6.22的复制存在bug(bug 74683)
12、SQL兼容性问题:SQL在MySQL 5.7和MySQL 5.6环境下结果可能不一致,因此建议获取线上SQL,在同样数据的环境下,在两个实例运行获取到的结果计算hash,比较hash值做兼容性判断


三、友情提醒
1、升级前一定要做好备份!!!
2、升级正式环境前提前在测试环境进行仔细测试,确认无误以后再升级正式环境。
3、做好相应的回退方案。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/601580.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

如何进行测试优先级划分

一般测试的优先级是从这三种情况进行划分:新模块测试、回归测试和特殊功能测试。 1、新单元模块的测试优先级 新模块单元,内部业务逻辑测试,优先级第一。新模块单元与其他模块的集成测试优先级第二。 对于新模块的测试,应以完成单…

消息队列的使用

消息队列 概念: 消息队列是System V IPC对象的一种 消息队列的使用: 发送端: 1 申请Key 2打开/创建消息队列 msgget 3向消息队列发送消息 msgsnd 接收端: 1打开/创建消息队列 msgget 2从消息队列接收消息 msgrcv …

一个29岁软件测试工程师的7年,太真实了...

当前就业环境,裁员、失业消息满天飞,好像有一份工作就不错了,更别说高薪了。其实这只是一方面,而另一方面,各大企业依然求贤若渴,高技术人才依然紧缺,只要你技术过硬,拿个年包50w不是…

Jetpack Compose 的最佳处理运行时权限的方法

Jetpack Compose 的最佳处理运行时权限的方法 如果您的应用安装在运行Android 6.0(API级别23)或更高版本的设备上,则必须按照本指南中的步骤为用户请求运行时权限。 在Jetpack Compose中获取运行时权限有两种方法。 使用Activity Result使用…

算法与数据结构-复杂度分析

文章目录 什么是大 O 复杂度表示法为什么要用大 O 复杂度表示法如何分析一段代码的时间复杂度1、只关注循环执行次数最多的一段代码2、加法法则:总复杂度等于量级最大的那段代码的复杂度3、乘法法则:嵌套代码的复杂度等于嵌套内外代码复杂度的乘积 几种常…

计算机网络常见面试题

参考:小林coding 1.TCP/IP模型 2.说一下TCP的三次握手? 第一次握手:客户端向服务端发起建立连接请求,客户端会随机生成一个起始序列号x,客户端向服务端发送的字段中包含标志位SYN=1,序列号seq=x。第一次握手前客户端的状态为CLOSE,第一次握手后客户端的状态为SYN-SENT。…

海外网红合作攻略:如何在转化率战场上脱颖而出

在当今社交媒体时代,与海外网红合作已成为企业推广产品与服务的重要途径之一。与海外网红合作不仅可以扩大品牌知名度,还能够吸引更多目标受众。然而,仅仅与网红合作并不能保证高转化率。本文Nox聚星将详细介绍几种有效的方法,帮助…

DDR跑不到速率,调整下PCB叠层就搞掂了?

高速先生成员--姜杰 关于DDR的案例,高速先生已经分享过很多期的文章了,有通过修改主控芯片的驱动解决问题的,有通过修改PCB走线的拓扑来解决问题的,也有通过调节端接电阻来解决问题的,相对于下面即将登场的解决方法而…

【Java|golang】2559. 统计范围内的元音字符串数

给你一个下标从 0 开始的字符串数组 words 以及一个二维整数数组 queries 。 每个查询 queries[i] [li, ri] 会要求我们统计在 words 中下标在 li 到 ri 范围内(包含 这两个值)并且以元音开头和结尾的字符串的数目。 返回一个整数数组,其中…

Flutter学习一:安装配置

目录 1 官方文档 2 安装配置 2.1 第一步:下载配置Flutter 2.2 第二步:下载配置Android Studio 2.3 第三步:下载配置VScode 1 官方文档 在 Windows 操作系统上安装和配置 Flutter 开发环境 - Flutter 中文文档 - Flutter 中文开发者网站…

从一个励志故事,读懂网络工程师的职业规划

这个励志故事主人公的起点,是在伟创力的工厂打螺丝。 改变 他很早不上学了,出社会的时候学历和技能什么也没有,就只能去工厂打螺丝。他在伟创力的工厂打螺丝打了好多年,在接近30岁的时候,他哥跟他说:你不能…

黑客零基础从入门到精通学习成长路线(超多图、非常详细),看完这一篇就够了

前言 近几年,随着移动互联网、大数据、云计算、人工智能等新一代信息技术的快速发展,围绕网络和数据的服务与应用呈现爆发式增长,丰富的应用场景下暴露出越来越多的网络安全风险和问题。 但是,我国网络安全整体投入不高。网络安…

基于YOLOv7开发构建红外高空小目标检测识别分析系统

基于yolo系列的模型开发构建红外场景下的目标检测系统,在我之前的文章中已经有好几次实践了,感兴趣的话可以自行移步阅读: 《红外海洋目标检测实践,基于目标检测模型识别红外海洋目标》 《基于YOLO开发构建红外场景下无人机航拍…

【Java基础】简单参数和springboot方式形参传递法

一、知识点整理 1、Postman 2、在原始的web程序中获取请求参数需通过HttpServletRequest对象手动获取 二、操作步骤 1、参考链接1下载postman,并创建工作空间。 2、打开idea,新建项目,选择Spring Initializar,依赖库勾选Web下…

Locust接口性能测试

谈到性能测试工具,我们首先想到的是LoadRunner或JMeter。LoadRunner是非常有名的商业性能测试工具,功能非常强大。但现在一般不推荐使用该工具来进行性能测试,主要是使用也较为复杂,而且该工具体积比较大,需要付费且价…

temu,速卖通,国际站如何稳定安全的测评补单,提升权重不降权

随着互联网和电子商务的快速发展,越来越多的企业和个人通过测评,补单进行产品推广和销售。然而,在测评,补单过程中,如何稳定安全地进行,以提升权重而不降权,成为了许多经营者关注的重要问题。林…

day44_项目1

今日内容 零、 复习昨日 零、 复习昨日 一、web开发流程 1.公司部门的组成人事部门HR技术部门(研发部/IT部/java组/h5组/c组/ui组/产品)行政部门财务部门市场部门运营部门总经理老板/董事/CEO2.项目部人员的组成 各种开发人员: UI/前端/后端(java/c/Python/c/android/Object-c…

CTFShow-WEB入门篇--信息搜集详细Wp

CTFShow-WEB入门篇详细Wp 信息收集:web1:web2:web3:web4:web5:web6:web7:web8:web9:web10:web11:web12:web13:…

基于linux的程序库文件打包和调用的实现(二)——动态库文件打包和调用

随着技术的发展,基于linux项目的软件代码越发复杂,原来一个人可以完成的软件项目,现在可能需要多个人合作、多个部门合作、多个企业合作,每个人、每个部门、每个企业可能负责部分软件模块的开发。各个软件模块在调试过程由于涉及企…

测试思想-集成测试 关于接口测试 Part 2

5. 用例设计思想(举例说明) 如上表,是某个接口说明文档中的一个接口,课程检索,其中“v1/Lesson/testsrch/?” 为接口调用地址,此外,还给出了接口函数输出(即Server Response)及返回值。 问:怎么设计&…