Home >Database >Mysql Tutorial >How to uninstall MySQL gracefully in Linux

How to uninstall MySQL gracefully in Linux

WBOY
WBOYforward
2023-05-29 23:16:041435browse

How to uninstall MySQL gracefully in Linux

1. Use the following command to check the current installation of mysql and find out whether mysql has been installed before

 rpm -qa|``grep` `-i mysql

You can see the following picture :

How to uninstall MySQL gracefully in Linux

Displays the 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

If you are prompted with a dependency package error, use the following command to try

 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

Use the following command to try:

 rpm -e --noscripts MySQL-client-5.5.25a-1.rhel5

3. Find the directory of the old version of mysql and delete the files and libraries of the old version of mysql

 find` `/ -name mysql

The search results are as follows:

 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 as follows: Find the directory and delete

How to uninstall MySQL gracefully in Linux

Note: /etc/my.cnf will not be deleted after uninstallation and needs to be deleted manually

 rm` `-rf ``/etc/my``.cnf

4. Check again whether the machine has mysql installed

 rpm -qa|``grep` `-i mysql

The above is the detailed content of How to uninstall MySQL gracefully in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete