How to thoroughly uninstall mysql in linux
1. Check whether mysql is installed before.
Run the: yum remove mysql * command to uninstall mysql and related components.
Command: rpm-qa | grep-I mysql
As shown in:
Note:
MySQL-client-5.5.25a-1.rhel5
MySQL-server-5.5.25a-1.rhel5
2. Stop the mysql service and delete the previously installed mysql
DELETE command: rpm-e-nodeps package name
# Rpm-ev MySQL-client-5.5.25a-1.rhel5
# Rpm-ev MySQL-server-5.5.25a-1.rhel5
3. Search for the directories of earlier mysql versions and delete the files and libraries of earlier mysql versions.
Find/-name mysql
The search result is as follows:
[Root @ localhost ~] # Find/-name mysql
/Var/lib/mysql
/Var/lib/mysql
/Usr/lib64/mysql
Delete the corresponding mysql directory
Rm-rf/var/lib/mysql
Rm-rf/var/lib/mysql
Rm-rf/usr/lib64/mysql
Perform specific steps to find and delete the Directory
Note: After uninstallation,/etc/my. cnf is not deleted and must be manually deleted.
Rm-rf/etc/my. cnf
4. Check whether mysql is installed on the machine again.
Rpm-qa | grep-I mysql
No results. It indicates that the installation is complete, and you can install mysql directly.