mysql5.7.32升级mysql5.7.33(rpm形式)

21
四月
2021

mysql5.7.32升级mysql5.7.33(rpm形式)

1.备份旧的数据库数据

mysqldump  -uroot -pZdkx#202 1-B syh -R --triggers  --master-data=2 --single-transaction | gzip > /backup/syh_20210421-2016.sql.gz

2.备份配置文件

cp /etc/my.cnf{,.bak}

3.停止旧的数据库

systemctl stop mysqld

4.在mysql官网获取最新的5.7.33版本

在这里插入图片描述

#下载地址
https://downloads.mysql.com/archives/community/
#创建目录
mkdir -p /data/mysql5.7.33
#下载软件包
wget  https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar

#解压缩
tar -xf mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar 
[root@localhost /data/mysql5.7.33]#ls
mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar        mysql-community-devel-5.7.33-1.el7.x86_64.rpm            mysql-community-embedded-devel-5.7.33-1.el7.x86_64.rpm  mysql-community-server-5.7.33-1.el7.x86_64.rpm
mysql-community-client-5.7.33-1.el7.x86_64.rpm  mysql-community-embedded-5.7.33-1.el7.x86_64.rpm         mysql-community-libs-5.7.33-1.el7.x86_64.rpm            mysql-community-test-5.7.33-1.el7.x86_64.rpm
mysql-community-common-5.7.33-1.el7.x86_64.rpm  mysql-community-embedded-compat-5.7.33-1.el7.x86_64.rpm  mysql-community-libs-compat-5.7.33-1.el7.x86_64.rpm

5.在线解决依赖安装

[root@localhost /data/mysql5.7.33]#pwd
/data/mysql5.7.33

cd  /data/mysql5.7.33

#解决依赖安装或用rpm升级
yum localupdate ./*.rpm -y 
或
rpm -Uvh  ./*.rpm 

6.检查配置文件/etc/my.cnf数据目录是否一样

配置文件一样则不用修改;不一致则将之前备份的覆盖现有的即可

7.启动mysql

systemctl start mysqld

8.查看mysql版本

[root@localhost /data/mysql5.7.33]#mysql -V
mysql  Ver 14.14 Distrib 5.7.33, for Linux (x86_64) using  EditLine wrapper

9.导入数据

#解压之前的gz文件包
gzip -d  /backup/syh_20210421-2016.sql.gz


#导入现的数据库
mysql -uroot -pZdkx#2021   syh < /backup/syh_20210421-2016.sql 

10.进入数据库检查有无库、表数据即可

TAG

网友评论

共有访客发表了评论
请登录后再发布评论,和谐社会,请文明发言,谢谢合作! 立即登录 注册会员