Centos上卸载MySQL8.0

1、查看当前mysql安装状况

rpm -qa | grep mysql
# 或
yum list install | grep mysql

image-20221007171715190

2、查看mysql的服务是否启动

systemctl status mysqld

image-20221007171744754

2.1、如果启动则关闭mysql服务

systemctl stop mysqld.service  # service可加可不加
# 停止MySQL的服务
[root@chenstudy ~]\# systemctl stop mysqld
# 再次查看MySQL的服务状态
[root@chenstudy ~]\# systemctl status mysqld

image-20221007172100413

3、 卸载上述命令查询出的已安装程序

yum remove mysql-community-libs-8.0.30-1.el7.x86_64
rpm -qa | grep mysql
yum remove mysql-community-client-plugins-8.0.30-1.el7.x86_64
rpm -qa | grep mysql
yum remove mysql-community-server-8.0.30-1.el7.x86_64
rpm -qa | grep mysql

图一

​ 图一:移除mysql-community-libs-8.0.30-1.el7.x86_64

图二

​ 图二:查看剩余的MySQL安装包

图三

​ 图三:移除mysql-community-client-plugins

image-20221007173904773

​ 图四:移除mysql-community-common

图五

​ 图五:再次查看MySQL的安装状态

图六

​ 图六:移除 mysql-community-icu-data-files

图七

​ 图七:移除mysql80-community-release-el7-7.noarch

4、删除mysql相关文件

  • 查找相关文件
find / -name mysql

image-20221007175553701

  • 删除上述命令查找出来的相关文件
rm -rf /usr/lib64/mysql
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql/mysql
rm -rf /etc/selinux/targeted/active/modules/100/mysql

image-20221007175654902

5、删除my.cnf

rm -rf /etc/my.cnf

image-20221007175806758

posted @ 2023-04-13 14:04  Hexrui  阅读(723)  评论(0编辑  收藏  举报
返回顶部