Explain how to completely delete mysql from Centos
- 2020-05-15 03:29:14
- OfStack
1. MySQL installed in yum mode
$ yum remove mysql mysql-server mysql-libs compat-mysql51
$ rm -rf /var/lib/mysq
$ rm /etc/my.cnf
Check if mysql software is available:
$ rpm -qa|grep mysql
If it exists, continue to delete it. Delete mode: yum remove + [name].
2. mysql installed by rpm
a) to see if mysql is installed in the rpm package in the system:
[root@localhost opt]# rpm -qa | grep -i mysql
MySQL-server-5.6.17-1.el6.i686
MySQL-client-5.6.17-1.el6.i686
Uninstall mysql b)
[root@localhost local]# rpm -e MySQL-server-5.6.17-1.el6.i686
[root@localhost local]# rpm -e MySQL-client-5.6.17-1.el6.i686
c) delete the mysql service
[root@localhost local]# chkconfig --list | grep -i mysql
[root@localhost local]# chkconfig --del mysql
d) delete the scattered mysql folder
[root@localhost local]# whereis mysql # or
find / -name mysql
mysql: /usr/lib/mysql /usr/share/mysql
Empty all directories and files associated with mysql
rm -rf /usr/lib/mysql
rm -rf /usr/share/mysql
rm -rf /usr/my.cnf
After the above steps, the mysql should have been completely uninstalled.