(1)暂停服务
systemctl stop mysqld
(2)查看所有的安装包,将其卸载
rpm -qa |grep mysql
rpm -q ( or --query) options
-a 查询所有安装的软件包
(3)使用yum卸载安装的mysql
[root@bo /etc/yum.repos.d]#sudo yum remove mysql mysql-server mysql-libs mysql-server
(4)查询剩余的安装包
(5)使用rpm -ev依次将其卸载
[root@bo /etc/yum.repos.d]#sudo rpm -ev mysql-community-release-el7-5.noarch
[root@bo /etc/yum.repos.d]sudo rpm -ev php71w-mysqlnd-7.1.33-1.w7.x86_64
[root@bo /etc/yum.repos.d]#sudo rpm -ev mysql-community-common-5.6.51-2.el7.x86_64
(6)查询残留文件并卸载
[root@bo /etc/yum.repos.d]#sudo find / -name mysql
[root@bo ~]#find / -name "mysql" | xargs -i rm -rf {}
(7)下载mysql,尝试启动
[root@bo /etc/yum.repos.d]#yum install mariadb-server mariadb -y
[root@bo /etc/yum.repos.d]#systemctl start mariadb