CentOS7 完全卸载yum 安装 mysql

2022/2/20 19:37:51

本文主要是介绍CentOS7 完全卸载yum 安装 mysql,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

CentOS7 完全卸载yum 安装 mysql

  1. 检查 rpm 包

    rpm -qa |grep -i mysql
    # 运行结果
    mysql-community-libs-5.7.37-1.el7.x86_64
    mysql57-community-release-el7-10.noarch
    mysql-community-server-5.7.37-1.el7.x86_64
    mysql-community-common-5.7.37-1.el7.x86_64
    mysql-community-libs-compat-5.7.37-1.el7.x86_64
    mysql-community-client-5.7.37-1.el7.x86_64
    
  2. 卸载 rpm

    yum remove mysql-community-libs-5.7.37-1.el7.x86_64
    yum remove mysql57-community-release-el7-10.noarch
    yum remove mysql-community-server-5.7.37-1.el7.x86_64
    yum remove mysql-community-common-5.7.37-1.el7.x86_64
    yum remove mysql-community-libs-compat-5.7.37-1.el7.x86_64
    yum remove mysql-community-client-5.7.37-1.el7.x86_64
    
  3. 重新检查应为空

    rpm -qa |grep -i mysql
    
  4. 查找 mysql 相关目录

    find / -name mysql
    # 运行结果
    /etc/selinux/targeted/active/modules/100/mysql
    /etc/selinux/targeted/tmp/modules/100/mysql
    /var/lib/mysql
    /var/lib/mysql/mysql
    /usr/share/mysql
    
  5. 逐一删除

    rm -rf /var/lib/mysql
    rm -rf /var/lib/mysql/mysql
    rm -rf /usr/share/mysql
    rm -rf /etc/selinux/targeted/tmp/modules/100/mysql
    rm -rf /etc/selinux/targeted/active/modules/100/mysql
    
  6. 删除配置文件

    rm -rf /etc/my.cnf
    
  7. 删除安装日志,防止重新安装无法记录密码

    rm -rf /var/log/mysqld.log
    


这篇关于CentOS7 完全卸载yum 安装 mysql的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程