- 安装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 {} \;