1、确认系统安装了哪些rpm包:
[root@host1 etc]# rpm -qa | grep -i mysql
mysql-server-5.1.71-1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
mysql-libs-5.1.71-1.el6.x86_64
qt-mysql-4.6.2-26.el6_4.x86_64
2、使用命令 rpm -ev package_name --nodeps
删除上步中检查到的所有包:
[root@host1 etc]# rpm -ev mysql-server-5.1.71-1.el6.x86_64 --nodeps
[root@host1 etc]# rpm -ev mysql-5.1.71-1.el6.x86_64 --nodeps
[root@host1 etc]# rpm -ev perl-DBD-MySQL-4.013-3.el6.x86_64 --nodeps
[root@host1 etc]# rpm -qa | grep -i mysql
mysql-server-5.1.71-1.el6.x86_64
mysql-5.1.71-1.el6.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
mysql-libs-5.1.71-1.el6.x86_64
qt-mysql-4.6.2-26.el6_4.x86_64
[root@host1 etc]# rpm -ev mysql-server-5.1.71-1.el6.x86_64 --nodeps
[root@host1 etc]# rpm -ev mysql-5.1.71-1.el6.x86_64 --nodeps
[root@host1 etc]# rpm -ev perl-DBD-MySQL-4.013-3.el6.x86_64 --nodeps
[root@host1 etc]# rpm -ev mysql-libs-5.1.71-1.el6.x86_64 --nodeps
[root@host1 etc]# rpm -ev qt-mysql-4.6.2-26.el6_4.x86_64 --nodeps
3、 查找老版本mysql相关的安装目录命令:find / -name mysql
[root@host1 etc]# find / -name mysql
/var/lib/mysql
4、使用命令 rm -rf directory_name 删除上步中查找到的所有目录:
[root@host1 etc]# rm -rf /var/lib/mysql/
5、
进入/etc/目录查看mysql的配置文件my.cnf是否存在,若存在则使用命令:rm –f my.cnf 进行删除。
[root@host1 etc]# pwd
/etc
[root@host1 etc]# ls my*
ls: cannot access my*: No such file or directory
6、删除系统
自带mysql用户和mysql用户组
:
[root@host1 etc]# userdel -r mysql
userdel: mysql home directory (/var/lib/mysql) not found
[root@host1 etc]# more /etc/passwd | grep mysql
[root@host1 etc]# groupdel mysql
groupdel: group 'mysql' does not exist
[root@host1 etc]# more /etc/shadow | grep mysql
[root@host1 etc]#
[root@host1 etc]# rpm -ev qt-mysql-4.6.2-26.el6_4.x86_64 --nodeps
3、 查找老版本mysql相关的安装目录命令:find / -name mysql
[root@host1 etc]# find / -name mysql
/var/lib/mysql
[root@host1 etc]# rm -rf /var/lib/mysql/
[root@host1 etc]# pwd
/etc
[root@host1 etc]# ls my*
ls: cannot access my*: No such file or directory
[root@host1 etc]# userdel -r mysql
userdel: mysql home directory (/var/lib/mysql) not found
[root@host1 etc]# more /etc/passwd | grep mysql
[root@host1 etc]# groupdel mysql
groupdel: group 'mysql' does not exist
[root@host1 etc]# more /etc/shadow | grep mysql
[root@host1 etc]#
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29067253/viewspace-2146754/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/29067253/viewspace-2146754/