MySQL之 CentOS下徹底解除安裝MySQL

2021-07-24 10:46:06 字數 2645 閱讀 6975

1、檢視mysql是否安裝

方式1:

[root@localhost usr]# yum list installed mysql*

loaded plugins: fastestmirror

loading mirror speeds from cached hostfile

* base: mirrors.yun-idc.com

* extras: mirror.neu.edu.cn

* updates: mirrors.yun-idc.com

installed packages

mysql-client.x86_64 5.6.27-1.el6 installed

mysql-devel.x86_64 5.6.27-1.el6 installed

mysql-server.x86_64 5.6.27-1.el6 installed

[root@localhost usr]#

方式2(

-i  :不區分大小寫

):

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

mysql-server-5.6.27-1.el6.x86_64

mysql-client-5.6.27-1.el6.x86_64

mysql-devel-5.6.27-1.el6.x86_64

[root@localhost usr]#

2、解除安裝mysql

解除安裝1:

[root@localhost usr]# yum remove mysql mysql-server mysql-libs compat-mysql51

[root@localhost usr]# rm -rf /var/lib/mysql

[root@localhost usr]# rm /etc/my.cnf

如果裝了mysql-devel(其他一樣add command),解除安裝為:

[root@tony_ts_tian init.d]# yum remove mysql mysql-devel mysql-server mysql-libs compat-mysql51
注(例如):

mysql-5.5.39-1.el6.remi.x86_64

mysql-libs-5.5.39-1.el6.remi.x86_64

compat-mysql51-5.1.54-1.el6.remi.x86_64

mysql-server-5.5.39-1.el6.remi.x86_64

解除安裝2:

[root@localhost mysql]# rpm -aq | grep -i mysql

mysql-server-5.6.27-1.el6.x86_64

mysql-client-5.6.27-1.el6.x86_64

mysql-devel-5.6.27-1.el6.x86_64

[root@localhost mysql]# rpm -e mysql-server-5.6.27-1.el6.x86_64

[root@localhost mysql]# rpm -e mysql-client-5.6.27-1.el6.x86_64

[root@localhost mysql]# rpm -e mysql-devel-5.6.27-1.el6.x86_64

[root@localhost rc.d]# cd /var/lib/

[root@localhost lib]# rm -rf mysql/

注:刪除mysql資料庫目錄(關鍵) ,否則password不更新(預設安裝,如果自定義安裝路徑和鏈結路徑ln -s ……請刪除。)

rm -rf /var/lib/mysql

解除安裝3:

[root@localhost usr]# whereis mysql

mysql: /usr/lib64/mysql

[root@localhost usr]# rm -rf /usr/lib64/mysql

注:find / -name mysql

rm -rf /usr/lib/mysql

rm -rf /usr/share/mysql

解除安裝4

[root@localhost usr]# rm –rf /usr/my.cnf

[root@localhost usr]# rm -rf /root/.mysql_sercret

解除安裝5(自啟服務):

[root@localhost usr]# chkconfig --list | grep -i mysql

[root@localhost usr]# chkconfig --del mysqld

此處刪除看自己設定:mysql/mysqld

CentOS下MySQL的徹底解除安裝

centos7下mysql的解除安裝 1 檢視mysql是否安裝 方式1 plain view plain copy root localhost usr yum list installed mysql loaded plugins fastestmirror loading mirror spe...

CentOS下MySQL的徹底解除安裝

centos7下mysql的解除安裝 1 檢視mysql是否安裝 方式1 root localhost usr yum list installed mysql loaded plugins fastestmirror loading mirror speeds from cached hostfi...

CentOS下MySQL的徹底解除安裝

centos7下mysql的解除安裝 1 檢視mysql是否安裝 方式1 plain view plain copy root localhost usr yum list installed mysql loaded plugins fastestmirror loading mirror spe...