Linux系统彻底卸载MySQL数据库详解
一、首先查询系统是否安装了MySQL
rpm -qa | grep -i mysql
输出结果表示,我安装的MySQL Server,Client都是5.6.44的,因为我系统支持的版本是要5.7+的版本,所以不得不卸载重装
二、关闭MySQL服务
查看MySQL服务运行状态:
service mysql status
如下图所示服务正在运行中:
停止MySQL服务:
service mysql stop
三、查看MySQL对应的文件夹
find / -name mysql
输出结果为:
/etc/selinux/targeted/active/modules/100/mysql
/etc/logrotate.d/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/share/mysql
/usr/bin/mysql
/usr/lib64/mysql
/etc/logrotate.d/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/share/mysql
/usr/bin/mysql
/usr/lib64/mysql
四、卸载并删除MySQL安装的组键服务
我的MySQL组件在刚开始的时候就已经查询了,主要就是下面这几个(所以使用 rpm -ev删除对应组件即可):
rpm -ev mysql-community-common-5.6.44-2.el7.x86_64
rpm -ev mysql-community-release-el7-5.noarch
rpm -ev mysql-community-client-5.6.44-2.el7.x86_64
rpm -ev mysql-community-server-5.6.44-2.el7.x86_64
rpm -ev mysql-community-libs-5.6.44-2.el7.x86_64
rpm -ev mysql-community-release-el7-5.noarch
rpm -ev mysql-community-client-5.6.44-2.el7.x86_64
rpm -ev mysql-community-server-5.6.44-2.el7.x86_64
rpm -ev mysql-community-libs-5.6.44-2.el7.x86_64
在卸载服务是遇到了三个组件服务无法卸载问题,提示缺少依赖postfix-2:2.10.1-7.el7.x86_64:
error: Failed dependencies:
libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
解决方法就是在 rpm -ev 加上–nodeps:
–nodeps就是安装时不检查依赖关系
五、删除系统中MySQL的所有文件夹:
在上面我们已经通过 find / -name mysql 查找出了所有文件夹,接下直接删除即可:
rm -rf /etc/selinux/targeted/active/modules/100/mysql
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql/mysql
rm -rf /usr/share/mysql
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql/mysql
rm -rf /usr/share/mysql
六、最后验证MySQL是否删除完成
rpm -qa | grep -i mysql
如若是空空如也者恭喜你删除成功了。
到此这篇关于Linux系统彻底卸载MySQL数据库的文章就介绍到这了,更多相关linux彻底卸载MySQL内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!