Method 1:
1. Check MySQL installation
rpm -qa|grep -i mysql
![Completely Uninstall MySQL 5.7 on CentOS 7 [Test Successful]](https://boardor.com/wp-content/uploads/2025/11/646eba51-cb48-479f-aaba-53e9e88a040e.jpg)
2. Stop MySQL service before uninstalling
rpm -ev --nodeps mysql-community-release-el7-5.noarch
rpm -ev --nodeps mysql-community-common-5.6.38-2.el7.x86_64
rpm -ev --nodeps mysql-community-client-5.6.38-2.el7.x86_64
rpm -ev --nodeps mysql-community-libs-5.6.38-2.el7.x86_64
rpm -ev --nodeps community-server-5.6.38-2.el7.x86_64
After executing the command, execute again rpm -qa|grep -i mysql to find that it has been uninstalled.
Or directly # yum -y remove mysql
Method 2:
Execute the command
find / -name mysql
![Completely Uninstall MySQL 5.7 on CentOS 7 [Test Successful]](https://boardor.com/wp-content/uploads/2025/11/353b9871-95e8-4f30-8b73-47b4e2d5e07e.jpg)
Delete the directories found
rm -rf the directories found above
![Completely Uninstall MySQL 5.7 on CentOS 7 [Test Successful]](https://boardor.com/wp-content/uploads/2025/11/52f8c17a-3645-4ae1-a020-d43d1adbf0fa.jpg)
If /etc/my.cnf exists, delete it manually, and MySQL will be completely uninstalled.
[root@node1 ~]# rm -rf /etc/my.cnf
[root@node1 ~]# rm -rf /var/lib/mysql/
![Completely Uninstall MySQL 5.7 on CentOS 7 [Test Successful]](https://boardor.com/wp-content/uploads/2025/11/df2f094d-6751-4cde-80e3-593675e4b85b.webp)
Copyright Statement: This content is from Tencent Cloud: OwenZhang, following the CC 4.0 BY-SA copyright agreement. The original text and this statement are included. This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 2.5 China Mainland License. Original link: https://cloud.tencent.com/developer/article/1915345 If there is any infringement, please contact us, and we will delete it immediately. Special thanks to the original author for their creation. All copyrights of this article belong to the original author and are unrelated to this public account. For commercial reprints, please contact the original author; for non-commercial reprints, please indicate the source.