请输入图片描述
1.备份配置和数据

[root@localhost ~]# cp /etc/my.cnf /etc/my.cnf.bak
[root@localhost bak]# mysqldump -u root -p ceshi ceshi > ceshi.sql

2.停止服务

[root@localhost mysql]# service mysql stop

3.检测配置现已安装的数据库

[root@localhost mysql]#  rpm -qa |grep -i mysql

MySQL-devel-5.6.27-1.rhel5.x86_64
MySQL-client-5.6.27-1.rhel5.x86_64
MySQL-server-5.6.27-1.rhel5.x86_64

4.移除安装的包

[root@localhost mysql]# rpm -qa | grep -i mysql | xargs rpm -ev --nodeps

软件包准备中...
MySQL-devel-5.6.27-1.rhel5.x86_64
MySQL-server-5.6.27-1.rhel5.x86_64
MySQL-client-5.6.27-1.rhel5.x86_64

5.下载5.7的包

[root@localhost mysql]# wget http://ai.9ihui.com:9632/mysql/mysql-5.7.28-1.el6.x86_64.rpm-bundle.tar

6.解压

[root@localhost mysql]# tar -xvf mysql-5.7.28-1.el6.x86_64.rpm-bundle.tar

7.安装新的包

[root@localhost mysql]# rpm -ivh mysql-community-common-5.7.28-1.el6.x86_64.rpm 

警告:mysql-community-common-5.7.28-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-common-5.7.28-1.e################################# [100%]

[root@localhost mysql]# rpm -ivh mysql-community-libs-5.7.28-1.el6.x86_64.rpm 

警告:mysql-community-libs-5.7.28-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-libs-5.7.28-1.el6################################# [100%]

[root@localhost mysql]# mysql-community-client-5.7.28-1.el6.x86_64.rpm mysql-community-common-5.7.28-1.el6.x86_64.rpm

mysql-community-client-5.7.28-1.el6.x86_64.rpm mysql-community-common-5.7.28-1.el6.x86_64.rpm
[root@localhost mysql]# rpm -ivh mysql-community-client-5.7.28-1.el6.x86_64.rpm
警告:mysql-community-client-5.7.28-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-client-5.7.28-1.e################################# [100%]

[root@localhost mysql]# rpm -ivh mysql-community-server-5.7.28-1.el6.x86_64.rpm --force --nodeps

警告:mysql-community-server-5.7.28-1.el6.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-server-5.7.28-1.e警告:/etc/my.cnf 已建立为 /etc/my.cnf.rpmnew

[100%]

8.启动服务

[root@localhost mysql]# service mysqld start

Starting mysqld (via systemctl): [ 确定 ]

9.刷新数据表

[root@localhost mysql]# mysql_upgrade -u root -p --force

然后重启服务

10.验证链接

11.查看数据是否丢失

其他备注
1.配置远程访问权限
grant all on *.* to 'root'@'%' identified by '111111';