MySQL的卸载
1、查看当前mysql安装状况
rpm -qa | grep mysql
# 或
yum list install | grep mysql
2、查看mysql的服务是否启动
systemctl status mysqld
2.1、如果启动则关闭mysql服务
systemctl stop mysqld.service # service可加可不加
# 停止MySQL的服务
[root@chenstudy ~]\# systemctl stop mysqld
# 再次查看MySQL的服务状态
[root@chenstudy ~]\# systemctl status mysqld
3、 卸载上述命令查询出的已安装程序
- yum remove mysql-community-libs-8.0.30-1.el7.x86_64
- rpm -qa | grep mysql
- yum remove mysql-community-client-plugins-8.0.30-1.el7.x86_64
- rpm -qa | grep mysql
- yum remove mysql-community-server-8.0.30-1.el7.x86_64
- rpm -qa | grep mysql
[root@chenstudy ~]# yum remove mysql-community-libs-8.0.30-1.el7.x86_64
[root@chenstudy ~]# rpm -qa | grep mysql
mysql-community-client-plugins-8.0.30-1.el7.x86_64
mysql80-community-release-el7-7.noarch
mysql-community-common-8.0.30-1.el7.x86_64
mysql-community-icu-data-files-8.0.30-1.el7.x86_64
[root@chenstudy ~]# yum remove mysql-community-client-plugins-8.0.30-1.el7.x86_64
[root@chenstudy ~]# rpm -qa | grep mysql
mysql80-community-release-el7-7.noarch
mysql-community-common-8.0.30-1.el7.x86_64
mysql-community-icu-data-files-8.0.30-1.el7.x86_64
[root@chenstudy ~]# yum remove mysql-community-common-8.0.30-1.el7.x86_64
[root@chenstudy ~]# rpm -qa | grep mysql
mysql80-community-release-el7-7.noarch
mysql-community-icu-data-files-8.0.30-1.el7.x86_64
[root@chenstudy ~]# yum remove mysql-community-icu-data-files-8.0.30-1.el7.x86_64
[root@chenstudy ~]# rpm -qa | grep mysql
mysql80-community-release-el7-7.noarch
[root@chenstudy ~]# yum remove mysql80-community-release-el7-7.noarch
图一:移除mysql-community-libs-8.0.30-1.el7.x86_64
图二:查看剩余的MySQL安装包
图三:移除mysql-community-client-plugins
图四:再次查看MySQL的安装状态
图五:移除 mysql-community-icu-data-files
图六:移除mysql80-community-release-el7-7.noarch
4、删除mysql相关文件
- 查找相关文件
find / -name mysql
- 删除上述命令查找出来的相关文件
rm -rf /usr/lib64/mysql
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql/mysql
rm -rf /etc/selinux/targeted/active/modules/100/mysql
[root@chenstudy ~]# find / -name mysql
/usr/local/mysql
/usr/lib64/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/etc/selinux/targeted/active/modules/100/mysql
[root@chenstudy ~]# rm -rf /usr/lib64/mysql
[root@chenstudy ~]# rm -rf /var/lib/mysql
[root@chenstudy ~]# rm -rf /var/lib/mysql/mysql
[root@chenstudy ~]# rm -rf /etc/selinux/targeted/active/modules/100/mysql
5、删除my.cnf
rm -rf /etc/my.cnf
[root@chenstudy ~]# rm -rf /etc/my.cnf
[root@chenstudy ~]#
标签:chenstudy,mysql,Linux,community,64,卸载,MySQL,root,el7
From: https://www.cnblogs.com/javaxiaohao/p/16767516.html