Home  >  Article  >  Operation and Maintenance  >  How to uninstall mysql in linux?

How to uninstall mysql in linux?

青灯夜游
青灯夜游Original
2019-05-21 09:26:5831140browse

How to uninstall mysql in linux?

Steps to uninstall mysql on linux:

1. First check the installation of mysql

rpm -qa|grep -i mysql

Displays the previous installation:

MySQL-client-5.5.25a-1.rhel5
MySQL-server-5.5.25a-1.rhel5

2. Stop the mysql service and delete the package

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 , then use the following command to try

rpm -ev MySQL-client-5.5.25a-1.rhel5 --nodeps

If the error prompt: error: %preun(xxxxxx) scriptlet failed, exit status 1

then 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

Search directory

find / -name mysql

The search results are as follows:

/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

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

No results, indicating that it has been completely uninstalled. Then just install mysql directly.

Related learning recommendations: mysql tutorial(video)

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn