Thoroughly uninstall mysql in Linux

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.