Completely uninstall the mysql database under Linux

Completely uninstall mysql under linux graphical tutorial

1. Find out if mysql was previously installed

Command: rpm -qa|grep -i mysql
You can see as shown in the following figure:

Instructions were previously installed:
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
The specific steps are shown in the figure: Find the directory and delete it

Note: /etc/my.cnf will not be deleted after uninstallation, you need to manually delete
 rm -rf /etc/my.cnf

4. Find out if mysql is installed on the machine again

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

 

Guess you like

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