Completely uninstall MySQL under Linux detailed
First, use the following command to view the current installation of MySQL, to find out if previously installed MySQL
You can see the following as shown:
The display was previously installed:
Mysql-client-5.5.25a-1.rhel5
Mysql-server-5.5.25a-1.rhel5
2. Stop the MySQL service, delete the previously installed MySQL
Delete command:rpm -e –nodeps 包名
12 |
rpm -ev MySQL-client-5.5.25a-1.rhel5 rpm -ev MySQL-server-5.5.25a-1.rhel5 |
If the prompt depends on the package error, use the following command to try
1 |
rpm -ev MySQL-client-5.5.25a-1.rhel5 --nodeps |
If you are prompted with an error:error: %preun(xxxxxx) scriptlet failed, exit status 1
Then try it with the following command:
1 |
rpm -e --noscripts MySQL-client-5.5.25a-1.rhel5 |
3, find the old version of MySQL directory, and delete the old version of MySQL files and libraries
The search results are as follows:
12345 |
find / -name mysql /var/lib/mysql /var/lib/mysql/mysql /usr/lib64/mysql |
Delete the corresponding MySQL directory
123 |
rm -rf /var/lib/mysql rm -rf /var/lib/mysql rm -rf /usr/lib64/mysql |
Specific steps to find the directory and delete
Note: /etc/my.cnf will not be removed after uninstallation, manual removal is required
4. Find out if the machine installs MySQL again
Completely uninstall MySQL under Linux detailed