centos 下完全卸载 mysql5.6
1 查看已经安装的服务
rpm -qa | grep -i mysql
-i 作用是不区分大小写
mysql-community-common-5.6.51-2.el7.x86_64
mysql-community-libs-5.6.51-2.el7.x86_64
mysql-community-server-5.6.51-2.el7.x86_64
mysql-community-release-el7-5.noarch
mysql-community-client-5.6.51-2.el7.x86_64
2 停掉mysql (若不停掉服务,无法卸载)
systemctl stop mysqld.service
3、执行卸载(卸载的内容都是步骤1查看的内容)
rpm -ev --nodeps mysql-community-release-el7-5.noarch
rpm -ev --nodeps mysql-community-client-5.6.51-2.el7.x86_64
rpm -ev --nodeps mysql-community-common-5.6.51-2.el7.x86_64
rpm -ev --nodeps mysql-community-server-5.6.51-2.el7.x86_64
rpm -ev --nodeps mysql-community-libs-5.6.51-2.el7.x86_64
(base) [root@VM-0-2-centos ~]#
(base) [root@VM-0-2-centos ~]# rpm -ev --nodeps mysql-community-release-el7-5.noarch
Preparing packages...
mysql-community-release-el7-5.noarch
(base) [root@VM-0-2-centos ~]# rpm -ev --nodeps mysql-community-client-5.6.51-2.el7.x86_64
Preparing packages...
mysql-community-client-5.6.51-2.el7.x86_64
(base) [root@VM-0-2-centos ~]# rpm -ev --nodeps mysql-community-common-5.6.51-2.el7.x86_64
Preparing packages...
mysql-community-common-5.6.51-2.el7.x86_64
(base) [root@VM-0-2-centos ~]# rpm -ev --nodeps mysql-community-server-5.6.51-2.el7.x86_64
Preparing packages...
mysql-community-server-5.6.51-2.el7.x86_64
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
(base) [root@VM-0-2-centos ~]# rpm -ev --nodeps mysql-community-libs-5.6.51-2.el7.x86_64
Preparing packages...
mysql-community-libs-5.6.51-2.el7.x86_64
查看 /etc/my.conf文件是否删除,若没有,执行删除
查看:
cd /etc/my.conf
-bash: cd: /etc/my.conf: No such file or directory
删除:
rm -rf /etc/my.cnf
rm /etc/my.cnf
ll /var/lib/mysql
rm -rf /var/lib/mysql
查看是否还有mysql软件:
rpm -qa|grep mysql
有的话继续删除
可以看到有两个安装包
MySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpm
MySQL-client-5.6.19-1.linux_glibc2.5.x86_64.rpm
删除这两个服务(去掉后缀)
rpm –e MySQL-client-5.6.19-1.linux_glibc2.5.x86_64
rpm -e MySQL-server-5.6.19-1.linux_glibc2.5.x86_64
查看残留的目录:
whereis mysql
mysql: /usr/share/mysql
然后删除mysql目录:
rm -rf /usr/share/mysql
删除相关文件:
rm -rf /usr/my.cnf
rm -rf /root/.mysql_sercret
最关键的:
rm -rf /var/lib/mysql
REF
https://www.cnblogs.com/haixiang/p/10194940.html
标签:x86,centos,5.6,51,community,mysql,el7 From: https://www.cnblogs.com/emanlee/p/18166785