centos mysql5.6 升级5.7

系统环境:centos7.2,linux3.10

[root@VM_0_15_centos ~]# uname -a
Linux VM_0_15_centos 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[root@VM_0_15_centos ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 

1、对数据库做好备份

[root@VM_0_15_centos ~]# mkdir /var/lib/mysqlcopy
[root@VM_0_15_centos ~]# cp -aR /var/lib/mysql/* /var/lib/mysqlcopy

2、查看原有mysql的安装包:

[root@VM_0_15_centos ~]#  rpm -qa | grep mysql
mysql-community-client-5.6.41-2.el7.x86_64
mysql-community-release-el7-5.noarch
mysql-community-devel-5.6.41-2.el7.x86_64
mysql-community-server-5.6.42-2.el7.x86_64
mysql-community-libs-5.6.41-2.el7.x86_64
mysql-community-common-5.6.42-2.el7.x86_64

3、全部卸载

[root@VM_0_15_centos ~]# yum remove mysql-community*

4、安装服务

[root@VM_0_15_centos ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
--2018-11-15 17:23:47--  https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm [following]
--2018-11-15 17:23:48--  https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.209.4.33
Connecting to repo.mysql.com (repo.mysql.com)|23.209.4.33|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25680 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-11.noarch.rpm’

100%[===============================================================================================================================================================================================>] 25,680      --.-K/
[root@VM_0_15_centos ~]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql57-community-release-el7-11 ################################# [100%]

6、安装mysql

[root@VM_0_15_centos ~]# yum -y install mysql-community-server

7、启动mysql

[root@VM_0_15_centos ~]# systemctl enable mysqld
[root@VM_0_15_centos ~]# systemctl start mysqld.service

8、更新

[root@VM_0_15_centos ~]# mysql_upgrade -u root -p

 

你可能感兴趣的:(mysql)