防止重装

    • yum方式
    1. 查看yum是否安装过mysql
    2. yum list installed mysql*

    如或显示了列表,说明系统中有MySQL
    image.png
    yum卸载
    根据列表上的名字

    1. yum remove mysql-community-client mysql-community-common mysql-community-libs mysql-community-libs-compat mysql-community-server mysql57-community-release
    2. rm -rf /var/lib/mysql
    3. rm /etc/my.cnf

    rpm查看安装
    rpm -qa | grep -i mysql

    1. rpm -e mysql57-community-release-el7-9.noarch
    2. rpm -e mysql-community-server-5.7.17-1.el7.x86_64
    3. rpm -e mysql-community-libs-5.7.17-1.el7.x86_64
    4. rpm -e mysql-community-libs-compat-5.7.17-1.el7.x86_64
    5. rpm -e mysql-community-common-5.7.17-1.el7.x86_64
    6. rpm -e mysql-community-client-5.7.17-1.el7.x86_64
    7. cd /var/lib/
    8. rm -rf mysql/

    清除余项

    1. whereis mysql
    2. mysql: /usr/bin/mysql /usr/lib64/mysql /usr/local/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
    3. #删除上面的文件夹
    4. rm -rf /usr/bin/mysql