linux下卸載mysql

一、關閉mysqlnode

# /etc/init.d/mysqld stop

二、找到mysql 開頭的軟件包信息mysql

#rpm -qa | grep 'mysql'

顯示sql

mysql-community-libs-compat-5.7.13-1.el6.x86_64
 mysql-community-libs-5.7.13-1.el6.x86_64
 mysql-community-client-5.7.13-1.el6.x86_64
 mysql-community-common-5.7.13-1.el6.x86_64
 mysql-community-server-5.7.13-1.el6.x86_64

刪除mysql 開頭的軟件包信息centos

#rpm -e mysql-community-libs-compat-5.7.13-1.el6.x86_64
#rpm -e  mysql-community-libs-5.7.13-1.el6.x86_64
#rpm -e mysql-community-client-5.7.13-1.el6.x86_64
#rpm -e mysql-community-common-5.7.13-1.el6.x86_64
#rpm -e mysql-community-server-5.7.13-1.el6.x86_64

 若是 刪除不掉mysql-community-libs-5.7.13-1.el6.x86_64bash

顯示post

[root@iZ25av9xi4hZ ~]# rpm -e mysql-libs-5.1.73-3.el6_5.x86_64
error: Failed dependencies:
	libmysqlclient.so.16()(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64
	libmysqlclient.so.16(libmysqlclient_16)(64bit) is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64
	mysql-libs is needed by (installed) postfix-2:2.6.6-6.el6_5.x86_64

則須要刪除加上--nodepscode

[root@iZ25av9xi4hZ ~]# rpm -e mysql-libs-5.1.73-3.el6_5.x86_64 --nodeps

三、刪除舊版本的mysql文件和目錄server

#find / -name 'mysql'
/usr/lib64/mysql
/usr/share/mysql
/usr/bin/mysql
/etc/logrotate.d/mysql
/var/lib/mysql

刪除ci

#rm -rf /usr/lib64/mysql
#rm -rf /usr/share/mysql
#rm -rf /usr/bin/mysql
#rm -rf /etc/logrotate.d/mysql
#rm -rf /var/lib/mysql

 四、刪除配置文件it

#rm -rf /etc/my.cnf

5刪除用戶,用戶組

#id mysql
#userdel mysql
#id mysql
顯示
id: mysql: No such user

centos刪除完mysql

若是是其餘系統,好比紅帽,須要刪除自帶的mysql 

rpm -qa | grep mariadb

卸載自帶的

rpm -e mariadb-libs-5.5.40-1.el7_0.x86_64 --nodeps

相關文章
相關標籤/搜索