数据库升级5.7.27---> 5.7.33

数据库升级5.7.27---> 5.7.33

目录

1,备份,

--flush-logs:刷新二进制日志

--master-data=2:记录备份时二进制日志的位置

--single-transaction :使用事务进行备份

mysqldump –uroot -p""   --all-databases   --flush-logs  --single-transaction --master-data=2  --default-character-set=utf8 >  /home/eastcom/mysqlback/msr_`date +%F`.sql

2,下载数据库软件包,上传到服务器。
[root@db_node1 upmysql] wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar #wget或者迅雷都可以下载
3,解压创建本地的yum仓库
 [root@db_node1 upmysql]#tar -xf mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar -C /tmp/upmysql
 
[root@db_node1 upmysql]# createrepo /tmp/upmysql/ #创建repodata文件

[root@db_node1 upmysql]# vim /etc/yum.repos.d/local.repo #其他yum源暂时关闭
[localserver]
name=localrepo
baseurl=file:///tmp/upmysql
enabled=1
gpgcheck=0
~
[root@db_node1 upmysql]# yum clean all; yum makecache #清理重新创建缓存
[root@db_node2 eastcom]# yum list | grep "mysql-*" #看查看是否具有5.7.33的包;
mysql-community-client.x86_64            5.7.27-1.el7               installed   
mysql-community-common.x86_64            5.7.27-1.el7               installed   
mysql-community-devel.x86_64             5.7.27-1.el7               installed   
mysql-community-libs.x86_64              5.7.27-1.el7               installed   
mysql-community-server.x86_64            5.7.27-1.el7               installed   
mysql-community-client.x86_64            5.7.33-1.el7               localserver 
mysql-community-common.x86_64            5.7.33-1.el7               localserver 
mysql-community-devel.x86_64             5.7.33-1.el7               localserver 
mysql-community-embedded.x86_64          5.7.33-1.el7               localserver 
mysql-community-embedded-compat.x86_64   5.7.33-1.el7               localserver 
mysql-community-embedded-devel.x86_64    5.7.33-1.el7               localserver 
mysql-community-libs.x86_64              5.7.33-1.el7               localserver 
mysql-community-libs-compat.x86_64       5.7.33-1.el7               localserver 
mysql-community-server.x86_64  

4,进入数据库,停止主从同步
Mysql [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.000 sec)

5,停止数据库;
[root@db_node1 ]# systemctl stop mysqld
6,升级
[root@db_node1 ]#yum update -y mysql-server #不是跨大版本几乎都能成功
7,启动数据库
[root@db_node1 ]#systemctl start mysqld 
8, 特别重要执行最后的升级语句
[root@db_node1 ]#mysql_upgrade -u root -p #输入密码
9,重启数据库
[root@db_node1 ]#systemctl restart mysqld
10, 进去数据库查看版本,并开启slave
[root@db_node1 ]#mysql -uroot -p
Mysql [(none)]> start  slave;
Query OK, 0 rows affected, 1 warning (0.000 sec)
11,在同步中创建一个测试表,查看主从是否正常
CREATE TABLE test1111 (
id int UNSIGNED AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(20) NOT NULL,
age tinyint UNSIGNED,
gender ENUM('M','F') default 'M'
)ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
12,查看其他使用数据库的软件是否正常

上一篇:centos7安装mysql


下一篇:Centos7.3云服务器上安装Nginx、MySQL、JDK、Tomcat环境