linux下mysql解除安裝

孤竹星發表於2015-05-08

1. 查詢安裝的mysql包

[root@root ~]# rpm -qa|grep -i mysql
mysql-community-libs-compat-5.6.24-3.el6.x86_64
mysql-community-libs-5.6.24-3.el6.x86_64
mysql-community-server-5.6.24-3.el6.x86_64
mysql-community-common-5.6.24-3.el6.x86_64
mysql-community-client-5.6.24-3.el6.x86_64

2. 停止mysql伺服器刪除mysql

[root@root ~]# sudo service mysqld stop
Stopping mysqld:  [  OK  ]
[root@root ~]# rpm -ev mysql-community-server-5.6.24-3.el6.x86_64
warning: /etc/my.cnf saved as /etc/my.cnf.rpmsave
[root@root ~]# rpm -ev mysql-community-client-5.6.24-3.el6.x86_64

自帶mysql包使用下面命令解除安裝

[root@root ~]# rpm -ev --nodeps mysql-community-libs-compat-5.6.24-3.el6.x86_64
[root@root ~]# rpm -ev --nodeps mysql-community-libs-5.6.24-3.el6.x86_64
[root@root ~]# rpm -ev --nodeps mysql-community-common-5.6.24-3.el6.x86_64

[root@root ~]# rpm -qa|grep -i mysql
[root@root ~]# 

3. 查詢mysql目錄,並且刪除mysql的檔案和庫

[root@root ~]# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/share/mysql
[root@root ~]# 
[root@root ~]# rm -rf /var/lib/mysql
[root@root ~]# rm -rf /usr/share/mysql

刪除my.cnf 檔案,刪除mysql-community-server已將my.cnf改名為my.cnf.rpmsave 
[root@root etc]# ls my.cnf*
my.cnf.rpmsave
[root@root etc]# rm -rf /etc/my.cnf.rpmsave 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28282660/viewspace-1629807/,如需轉載,請註明出處,否則將追究法律責任。

相關文章