Linux服务器卸载mysql指南
一、环境简介
操作系统:CentOS7.6
[root@mysqldb2 ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core)
二、卸载步骤
2.1、查看当前环境是否安装有mysql
rpm -qa|grep -i mysql
注:-i参数表示不区分大小写
显示如下:
mysql-community-server-8.0.15-1.el7.x86_64 mysql-community-common-8.0.15-1.el7.x86_64 mysql-community-libs-8.0.15-1.el7.x86_64 mysql-community-client-8.0.15-1.el7.x86_64
2.2、停库
systemctl stop mysqld
2.3、无依赖删除mysql
[root@mysqldb2 ~]# rpm -e --nodeps mysql-community-server warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave [root@mysqldb2 ~]# rpm -e --nodeps mysql-community-client [root@mysqldb2 ~]# rpm -e --nodeps mysql-community-libs [root@mysqldb2 ~]# rpm -e --nodeps mysql-community-common
2.4、找出mysql的目录并删除
[root@mysqldb2 ~]# find / -name mysql /var/lib/mysql /var/lib/mysql/mysql
确认无误后,删除目录
[root@mysqldb2 ~]# rm -rf /var/lib/mysql/
此外,在/etc/my.cnf.rpmsave中,还有这个目录
[root@mysqldb2 ~]# cat /etc/my.cnf.rpmsave
注意log-error对应的路径:
log-error=/var/log/mysqld.log
删除/var/log/mysqld.log
[root@mysqldb2 ~]# rm -rf /var/log/mysqld.log
至此,mysql卸载完成。