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
    
上一篇:[Error Code 1366: Incorrect string value: '\xE5\xB0\x8F\xE6\x98\x8E' for column


下一篇:中间件在LINUX开发