- 安裝MySql
https://blog.csdn.net/tongxin_tongmeng/article/details/128263398
- 停止服務
service mysql stop
- 刪除服務
chkconfig --del mysql
- 刪除目錄
rm -rf /opt/mysql
- ?刪除配置
rm -f /etc/my.cnf
- 刪除啟動腳本
rm -f /etc/init.d/mysql
- 刪除用戶和組
userdel mysql && groupdel mysql
- 刪除環境變量
sed -i '/export MYSQL_HOME=\/opt\/mysql\/basedir/d' /etc/profile sed -i '/export PATH=\$PATH:\$MYSQL_HOME\/bin/d' /etc/profile source /etc/profile
- 刪除防火墻規則
firewall-cmd --zone=public --remove-port=3306/tcp --permanent && firewall-cmd --reload
- 刪除YUM安裝包
yum remove mysql
- 刪除RPM安裝包
rpm -e --nodeps `rpm -qa | grep -i mysql` && rm -rf /var/lib/mysql /etc/my.cnf.rpmsave /var/log/mysqld.log
- 清理剩余文件
find / -name 'mysql' -exec rm -rf {} \;