CentOS卸载MySQL

  1. 查看MySQL状态
systemctl status mysqld

2.如果MySQL处于启动状态,则停止MySQL

systemctl stop mysqld

3.取消开机自启动

systemctl disable mysqld

4.查找已安装的MySQL包

rpm -qa | grep -i mysql
# 或
yum list installed | grep -i mysql
mysql-community-client.x86_64      8.0.33-1.el7               @mysql80-community
mysql-community-client-plugins.x86_64
                                   8.0.33-1.el7               @mysql80-community
mysql-community-common.x86_64      8.0.33-1.el7               @mysql80-community
mysql-community-icu-data-files.x86_64
                                   8.0.33-1.el7               @mysql80-community
mysql-community-libs.x86_64        8.0.33-1.el7               @mysql80-community
mysql-community-libs-compat.x86_64 8.0.33-1.el7               @mysql80-community
mysql-community-server.x86_64      8.0.33-1.el7               @mysql80-community
mysql80-community-release.noarch   el7-7                      installed  

5.卸载

# 删除,一直删到查不出来为止
yum remove mysql-community-server.x86_64
yum remove mysql-community-client.x86_64
yum remove mysql80-community-release.noarch
...

6.删除MySQL相关文件
查找文件,删除找到的文件

find / -name mysql

删除my.cnf

rm /etc/my.cnf
posted @ 2024-09-09 17:36  年迈的魔法师  阅读(15)  评论(0编辑  收藏  举报