Thoroughly uninstall mysql in Linux
1. Run the following command to check whether mysql is installed.
rpm -qa|grep -i mysql
As shown in:
It is shown that the previous installation is:
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
If a dependency package error is prompted, use the following command to try
rpm -ev MySQL-client-5.5.25a-1.rhel5 --nodeps
If an error is prompted:error: %preun(xxxxxx) scriptlet failed, exit status 1
Run the following command:
rpm -e --noscripts MySQL-client-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:
find / -name mysql /var/lib/mysql/var/lib/mysql/mysql/usr/lib64/mysql
Delete the corresponding mysql directory
rm -rf /var/lib/mysqlrm -rf /var/lib/mysqlrm -rf /usr/lib64/mysql
Perform specific steps to find and delete the Directory
Note:After uninstallation,/etc/my. cnf will not be 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
Summary
If no result is displayed, it indicates that the installation is complete. then install mysql directly. The above is all the content of this article. I hope the content of this article will help you in your study or work. If you have any questions, please leave a message. Thank you for your support.