#查看当前安装mysql情况 [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -qa|grep -i mysql
mysql-community-common-5.5.61-2.el6.x86_64
mysql-community-client-5.5.61-2.el6.x86_64
mysql-community-server-5.5.61-2.el6.x86_64
mysql-libs-5.1.73-8.el6_8.x86_64
mysql-community-libs-5.5.61-2.el6.x86_64
显示有如上几个,挨个卸载
[root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -ev mysql-community-common-5.5.61-2.el6.x86_64
报如下错误:
error: Failed dependencies:
mysql-community-common(x86-64) >= 5.5.8 is needed by (installed) mysql-community-libs-5.5.61-2.el6.x86_64
mysql-community-common(x86-64) = 5.5.61-2.el6 is needed by (installed) mysql-community-server-5.5.61-2.el6.x86_64
重试如下命令:
[root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -ev mysql-community-common-5.5.61-2.el6.x86_64 --nodeps [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rmp -ev mysql-community-client-5.5.61-2.el6.x86_64 --nodeps bash: rmp: command not found [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -ev mysql-community-client-5.5.61-2.el6.x86_64 --nodeps [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -ev mysql-community-server-5.5.61-2.el6.x86_64 --nodeps [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -ev mysql-libs-5.1.73-8.el6_8.x86_64 --nodeps warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -ev mysql-community-libs-5.5.61-2.el6.x86_64 --nodeps
卸载完毕,再检查一下
[root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -qa|grep -i mysql [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]#
删除对应文件
[root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# find / -name mysql /var/lib/mysql /var/lib/mysql/mysql /usr/share/mysql [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rm -rf /var/lib/mysql/ [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rm -rf /var/lib/mysql/mysql [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rm -rf /usr/share/mysql
配置文件也需要手动删除
[root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rm -rf /etc/my.cnf
再次确认
[root@iZwz97hxl5q1kwu1lhn5cwZ suntree]# rpm -qa|grep -i mysql [root@iZwz97hxl5q1kwu1lhn5cwZ suntree]#
搞定