Delete and uninstall MySQL mysql that comes with Linux
How to uninstall mysql in linux
1. check whether mysql is installed before.
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.