永利视讯 > 数据库 > Linux下卸载MySQL8.0版本的操作方法
2019
11-09

Linux下卸载MySQL8.0版本的操作方法



一、关闭MySQL

[[email protected] /]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
二、查看当前安装mysql情况,查找以前是否装有mysql

[[email protected] /]# rpm -qa|grep -i mysql
mysql-community-client-8.0.13-1.el7.x86_64
mysql-community-libs-8.0.13-1.el7.x86_64
mysql-community-common-8.0.13-1.el7.x86_64
mysql-community-server-8.0.13-1.el7.x86_64
三、执行命令删除安装的MySQL

[[email protected] /]# rpm -ev mysql-community-client-8.0.13-1.el7.x86_64

报错:

error: Failed dependencies:
永利视讯     mysql-community-client(x86-64) >= 8.0.0 is needed by (installed) mysql-community-server-8.0.13-1.el7.x86_64

原因是依赖包错误,再执行以下命令解决:

[[email protected] /]# rpm -ev mysql-community-client-8.0.13-1.el7.x86_64 --nodeps

剩余几个也按照上述操作执行,加上 --nodeps

永利视讯 再执行 # rpm -qa|grep -i mysql 命令,查看是否删除成功。

四:查看之前安装的MySQL的目录并删除

[[email protected] /]# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql
/usr/share/mysql
[[email protected] /]# rm -rf /var/lib/mysql
[[email protected] /]# rm -rf /var/lib/mysql/mysql
[[email protected] /]# rm -rf /usr/lib64/mysql
[[email protected] /]# rm -rf /usr/share/mysql

五:删除my.cnf

永利视讯 卸载后/etc/my.cnf不会删除,需要进行手工删除

[[email protected] /]# rm -rf /etc/my.cnf
最后查看一下是否卸载完毕,无结果说明卸载完成

[[email protected] /]# rpm -qa|grep -i mysql