---------- 20190109 MySQL-Remove.txt 完全清除 mySQL 1. 檢查目前安裝的mysql: # rpm -qa | grep -i mysql mysql-community-common-5.7.24-1.el7.x86_64 mysql-community-server-5.7.24-1.el7.x86_64 mysql-community-client-5.7.24-1.el7.x86_64 mysql-community-libs-5.7.24-1.el7.x86_64 2. 解除安裝 yum remove mysql-community-common-5.7.24-1.el7.x86_64 yum remove mysql-community-server-5.7.24-1.el7.x86_64 yum remove mysql-community-client-5.7.24-1.el7.x86_64 yum remove mysql-community-libs-5.7.24-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/pcp/config/pmlogconf/mysql /var/lib/mysql /var/lib/mysql/mysql /usr/share/mysql 5. 刪除mysql相關目錄: rm -rf /etc/selinux/targeted/active/modules/100/mysql rm -rf /etc/selinux/targeted/tmp/modules/100/mysql rm -rf /var/lib/pcp/config/pmlogconf/mysql rm -rf /var/lib/mysql rm -rf /var/lib/mysql/mysql rm -rf /usr/share/mysql 6. 刪除 /etc/my.cnf rm -rf /etc/my.cnf 無此檔案. 7. 刪除 /var/log/mysqld.log. 若/var/log/mysqld.log 沒有刪除, 則新安裝的 mysql 無法產生新密碼, 無法登入.