Uninstall mysql under linux

Completely uninstall mysql under linux

1. Find out if mysql was installed before

command: rpm -qa|grep -i mysql



Description:
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. Find the directory of the previous version of mysql, and delete the files and libraries of the old version of mysql

find / -name mysql
The search results are as follows:
[root@localhost ~]# find / -name mysql
/var/lib/mysql
/var/ lib/mysql/mysql
/usr/lib64/mysql

delete the corresponding mysql directory
rm -rf /var/lib/mysql
rm -rf /var/lib/mysql
rm -rf /usr/lib64/mysql
find the directory and delete it



NoteAfter /etc/my.cnf will not be deleted, it needs to be deleted manually
rm -rf /etc/my.cnf

4. Check again whether mysql is installed on the machine

rpm -qa|grep -i mysql
has no result, indicating that it has been uninstalled completely, then install mysql directly

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326571677&siteId=291194637