如何在Linux下卸載MySQL數(shù)據(jù)庫(kù)呢? 下面總結(jié)、整理了一下Linux平臺(tái)下卸載MySQL的方法。 MySQL的安裝主要有三種方式:二進(jìn)制包安裝(Using Generic Binaries)、RPM包安裝、源碼安裝。對(duì)應(yīng)不同的安裝方式,卸載的步驟有些不同。文章中如有不足或不對(duì)的地方,敬請(qǐng)指出或補(bǔ)充!
RPM包安裝方式的MySQL卸載
1、檢查是否安裝了MySQL組件。
| [root@DB-Server init.d]# rpm -qa | grep -i mysqlMySQL-devel-5.6.23-1.linux_glibc2.5MySQL-client-5.6.23-1.linux_glibc2.5 MySQL-server-5.6.23-1.linux_glibc2.5 |

如上所示,說(shuō)明安裝了MySQL 5.6.23這個(gè)版本的client、server、devel三個(gè)組件。
2、卸載前關(guān)閉MySQL服務(wù)
2.1 方法1
| [root@DB-Server init.d]# service mysql status MySQL running (25673)[ OK ][root@DB-Server init.d]# service mysql stop Shutting down MySQL..[ OK ][root@DB-Server init.d]# service mysql status MySQL is not running[FAILED] |

2.2 方法2
| [root@DB-Server init.d]# ./mysql status MySQL running (26215)[ OK ][root@DB-Server init.d]# ./mysql stop Shutting down MySQL..[ OK ][root@DB-Server init.d]# ./mysql status MySQL is not running[FAILED][root@DB-Server init.d]# |

| [root@DB-Server init.d]# chkconfig --list | grep -i mysqlmysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@DB-Server init.d]# |
3. 收集MySQL對(duì)應(yīng)的文件夾信息
[root@DB-Server init.d]# whereis mysql
mysql: /usr/bin/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
最好實(shí)用find命令查看MySQL數(shù)據(jù)庫(kù)相關(guān)的文件,方便后面徹底刪除MySQL。
| [root@DB-Server init.d]# find / -name mysql/etc/rc.d/init.d/mysql/etc/logrotate.d/mysql/var/lock/subsys/mysql/var/lib/mysql/var/lib/mysql/mysql/usr/include/mysql/usr/include/mysql/mysql/usr/bin/mysql/usr/share/mysql/usr/lib64/mysql |

4、卸載刪除MySQL各類組件
| [root@DB-Server init.d]# [root@DB-Server init.d]# rpm -ev MySQL-devel-5.6.23-1.linux_glibc2.5[root@DB-Server init.d]# rpm -ev MySQL-server-5.6.23-1.linux_glibc2.5You have new mail in /var/spool/mail/root[root@DB-Server init.d]# rpm -ev MySQL-client-5.6.23-1.linux_glibc2.5[root@DB-Server init.d]# |

5、刪除MySQL對(duì)應(yīng)的文件夾
新聞熱點(diǎn)
疑難解答
圖片精選