本文目錄一覽:
Linux下如何徹底刪除MySQL
1、查找以前是否裝有mysql
命令:rpm -qa|grep -i mysql
可以看到如下圖的所示:
說明之前安裝了:
MySQL-client-5.5.25a-1.rhel5
MySQL-server-5.5.25a-1.rhel5
2、停止mysql服務、刪除之前安裝的mysql
刪除命令:rpm -e –nodeps 包名
# rpm -ev MySQL-client-5.5.25a-1.rhel5
# rpm -ev MySQL-server-5.5.25a-1.rhel5
3、查找之前老版本mysql的目錄、並且刪除老版本mysql的文件和庫
find / -name mysql
查找結果如下:
[root@localhost ~]# find / -name mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql
刪除對應的mysql目錄
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql
rm -rf /usr/lib64/mysql
具體的步驟如圖:查找目錄並刪除
注意:卸載後/etc/my.cnf不會刪除,需要進行手工刪除
rm -rf /etc/my.cnf
4、再次查找機器是否安裝mysql
rpm -qa|grep -i mysql
無結果,說明已經卸載徹底、接下來直接安裝mysql即可
linux卸載mysql數據庫
linux卸載mysql數據庫的步驟:
第一步:查看系統中是否以rpm包安裝的mysql
[plain] view plaincopyprint?
[root@linux ~]# rpm -qa | grep -i mysql
MySQL-server-5.1.49-1.glibc23
MySQL-client-5.1.49-1.glibc23
第二步:卸載MySQL-server-5.1.49-1.glibc23和MySQL-client-5.1.49-1.glibc23
[plain] view plaincopyprint?
[root@linux ~]# rpm -e MySQL-client-5.1.49-1.glibc23
[root@linux ~]# rpm -e MySQL-server-5.1.49-1.glibc23
第三步:查看有沒有mysql服務
[plain] view plaincopyprint?
[root@linux ~]# chkconfig –list | grep -i mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
第四步:刪除mysql服務
[plain] view plaincopyprint?
[root@linux ~]# chkconfig –del mysql
第五步:刪除分散mysql文件夾
[plain] view plaincopyprint?
[root@linux ~]# whereis mysql
mysql: /usr/lib/mysql /usr/share/mysql
第六步:分別刪除
[plain] view plaincopyprint?
[root@linux lib]# rm -rf /usr/lib/mysql/
[root@linux lib]# rm -rf /usr/share/mysql
通過以上步驟就可以卸載乾淨mysql了。
linux 怎麼完全卸載mysql數據庫
a)查看系統中是否以rpm包安裝的mysql
[plain] view plain copy
[root@linux ~]# rpm -qa | grep -i mysql
MySQL-server-5.1.49-1.glibc23
MySQL-client-5.1.49-1.glibc23
卸載MySQL-server-5.1.49-1.glibc23和MySQL-client-5.1.49-1.glibc23
[plain] view plain copy
[root@linux ~]# rpm -e MySQL-client-5.1.49-1.glibc23
[root@linux ~]# rpm -e MySQL-server-5.1.49-1.glibc23
b)查看有沒有mysql服務
[plain] view plain copy
[root@linux ~]# chkconfig –list | grep -i mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
刪除mysql服務
[plain] view plain copy
[root@linux ~]# chkconfig –del mysql
c)刪除分散mysql文件夾
[plain] view plain copy
[root@linux ~]# whereis mysql
mysql: /usr/lib/mysql /usr/share/mysql
分別刪除
[plain] view plain copy
[root@linux lib]# rm -rf /usr/lib/mysql/
[root@linux lib]# rm -rf /usr/share/mysql
通過以上幾步,mysql應該已經完全卸載乾淨了
原創文章,作者:GN34Z,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/129329.html