CentOS下二进制包/源码安装方式的MySQL卸载步骤
CentOS下二进制包/源码安装方式的MySQL卸载步骤
转自https://www.cnblogs.com/zendwang/p/6519921.html
查看当前系统mysql 运行状态
|
1
2
3
4
|
[root@zendlinux ~]# ps -ef |grep mysqlroot 1153 1 0 15:40 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/zendlinux.pidmysql 1695 1153 0 15:40 ? 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/var/zendlinux.err --open-files-limit=65535 --pid-file=/usr/local/mysql/var/zendlinux.pid --socket=/tmp/mysql.sock --port=3306root 1736 1716 0 15:53 pts/0 00:00:00 grep mysql |
查看mysqld状态,并关闭
|
1
2
3
4
|
[root@zendlinux ~]# service mysqld statusSUCCESS! MySQL running (1695)[root@zendlinux ~]# service mysqld stopShutting down MySQL. SUCCESS! |
查看开机启动情况
|
1
2
|
[root@zendlinux ~]# chkconfig --list |grep -i mysqlmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
查找MySQL的安装目录并彻底删除
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
[root@zendlinux ~]# whereis mysqlmysql: /usr/bin/mysql /usr/lib/mysql /usr/include/mysql /usr/local/mysql[root@zendlinux ~]# find / -name mysql/var/spool/mail/mysql/usr/lib/mysql/usr/include/mysql/usr/local/mysql/usr/local/mysql/var/mysql/usr/local/mysql/include/mysql/usr/local/mysql/bin/mysql/usr/bin/mysql[root@zendlinux ~]# rm -rf /usr/bin/mysql /usr/local/mysql /usr/include/mysql /var/spool/mail/mysql /usr/lib/mysql[root@zendlinux ~]# find / -name mysql |
删除一些配置文件
配置文件一般有/etc/my.cnf 或/etc/init.d/mysqld,视具体安装配置情况而定。
|
1
2
|
[root@zendlinux ~]# rm -rf /etc/my.cnf[root@zendlinux ~]# rm -rf /etc/init.d/mysqld |
删除MySQL用户以及用户组
|
1
2
3
4
|
[root@zendlinux ~]# id mysqluid=500(mysql) gid=500(mysql) groups=500(mysql)[root@zendlinux ~]# userdel mysql[root@zendlinux ~]# id mysql |
浙公网安备 33010602011771号