CentOS下MySQL的徹底卸載


#################CentOS7下MySQL的卸載####################

1:查看MySQL是否安裝:

 方式1:

[plain] view plain copy
  1. [root@localhost usr]# yum list installed mysql*  
  2. Loaded plugins: fastestmirror  
  3. Loading mirror speeds from cached hostfile  
  4.  * base: mirrors.yun-idc.com  
  5.  * extras: mirror.neu.edu.cn  
  6.  * updates: mirrors.yun-idc.com  
  7. Installed Packages  
  8. MySQL-client.x86_64   5.6.27-1.el6    installed  
  9. MySQL-devel.x86_64    5.6.27-1.el6    installed  
  10. MySQL-server.x86_64   5.6.27-1.el6    installed  
  11. [root@localhost usr]#  

 

方式2( -i  :不區分大小寫):

[plain] view plain copy
  1. [root@localhost usr]# rpm -qa | grep -i mysql  
  2. MySQL-server-5.6.27-1.el6.x86_64  
  3. MySQL-client-5.6.27-1.el6.x86_64  
  4. MySQL-devel-5.6.27-1.el6.x86_64  
  5. [root@localhost usr]#   
  • [root@localhost usr]# rm -rf /var/lib/mysql  
  • [root@localhost usr]# rm /etc/my.cnf  

如果裝了mysql-devel(其他一樣add command),卸載為:

[plain] view plain copy
  1. [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{繼續,1,2選擇一種(此處為介紹):}:
[plain] view plain copy
  1. [root@localhost mysql]# rpm -aq | grep -i mysql  
  2. MySQL-server-5.6.27-1.el6.x86_64  
  3. MySQL-client-5.6.27-1.el6.x86_64  
  4. MySQL-devel-5.6.27-1.el6.x86_64  
  5. [root@localhost mysql]# rpm -e MySQL-server-5.6.27-1.el6.x86_64  
  6. [root@localhost mysql]# rpm -e MySQL-client-5.6.27-1.el6.x86_64  
  7. [root@localhost mysql]# rpm -e MySQL-devel-5.6.27-1.el6.x86_64  
  8. [root@localhost rc.d]# cd /var/lib/  
  9. [root@localhost lib]# rm -rf mysql/  
注:刪除MySQL數據庫目錄(關鍵) ,否則password不更新(默認安裝,如果自定義安裝路徑和鏈接路徑ln -s ……請刪除。)
   rm -rf /var/lib/mysql
卸載3:
[plain] view plain copy
  1. [root@localhost usr]# whereis mysql  
  2. mysql: /usr/lib64/mysql  
  3. [root@localhost usr]# rm -rf /usr/lib64/mysql  
注:find / -name mysql
注:清空相關mysql的所有目錄以及文件和其他配置和設置等。如果有,則刪除。也必須考慮其他軟件不去影響。
rm -rf /usr/lib/mysql
rm -rf /usr/share/mysql
卸載4
[plain] view plain copy
  1. [root@localhost usr]# rm –rf /usr/my.cnf  
  2. [root@localhost usr]# rm -rf /root/.mysql_sercret   
卸載5(自啟服務):
[plain] view plain copy
  1. [root@localhost usr]# chkconfig --list | grep -i mysql  
  2. [root@localhost usr]# chkconfig --del mysqld  
[plain] view plain copy
    1. 此處刪除看自己設置:mysql/mysqld  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM