# Linux卸载源码/二进制包安装的MySQL
### 1、查看mysql运行状态,如果是正在运行,需先关闭
`systemctl status mysqld`
### 2、关闭MySQL服务并设置开机不自启
`systemctl stop mysqld`
`systemctl disable mysqld`
### 3、搜索相关配置文件并删除
```
[root@localhost mysql]# find / -name mysql
/run/lock/subsys/mysql
/etc/selinux/targeted/active/modules/100/mysql
/var/lib/mysql
/var/spool/mail/mysql
/usr/lib64/mysql
/usr/share/mysql
/usr/local/mysql
/usr/local/mysql/bin/mysql
/usr/local/mysql/include/mysql
/usr/local/mysql/data/mysql
/home/mysql
[root@localhost mysql]# cd /
[root@localhost /]# rm -rf /run/lock/subsys/mysql /etc/selinux/targeted/active/modules/100/mysql /var/lib/mysql /var/spool/mail/mysql /usr/lib64/mysql /usr/share/mysql /usr/local/mysql /usr/local/mysql/bin/mysql /usr/local/mysql/include/mysql /usr/local/mysql/data/mysql /home/mysql
\# 以下删除的内容,如果存在的话,删除
[root@localhost /]# rm -rf /etc/my.cnf*
[root@localhost /]#
[root@localhost /]# rm -rf /etc/init.d/mysqld
[root@localhost /]# find / -name mysql
```
### 4、删除mysql用户
```
[root@localhost /]# id mysql
uid=1000(mysql) gid=1000(mysql) 组=1000(mysql
```
`[root@localhost /]# userdel mysql`
```
```
[root@localhost /]# id mysql
id: mysql: no such user
```
```
**完成******