The steps for uninstalling MySQL in CentOS Binary Package/source code installation are as follows: centosmysql
View the mysql running status of the current system
[root@zendlinux ~]# ps -ef |grep mysqlroot 1153 1 0 15:40 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/zendlinux.pidmysql 1695 1153 0 15:40 ? 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/var/zendlinux.err --open-files-limit=65535 --pid-file=/usr/local/mysql/var/zendlinux.pid --socket=/tmp/mysql.sock --port=3306root 1736 1716 0 15:53 pts/0 00:00:00 grep mysql
View the status of mysqld and disable
[root@zendlinux ~]# service mysqld statusSUCCESS! MySQL running (1695)[root@zendlinux ~]# service mysqld stopShutting down MySQL. SUCCESS!
View startup status
[root@zendlinux ~]# chkconfig --list |grep -i mysqlmysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Find the MySQL installation directory and delete it permanently
[root@zendlinux ~]# whereis mysqlmysql: /usr/bin/mysql /usr/lib/mysql /usr/include/mysql /usr/local/mysql[root@zendlinux ~]# find / -name mysql/var/spool/mail/mysql/usr/lib/mysql/usr/include/mysql/usr/local/mysql/usr/local/mysql/var/mysql/usr/local/mysql/include/mysql/usr/local/mysql/bin/mysql/usr/bin/mysql[root@zendlinux ~]# rm -rf /usr/bin/mysql /usr/local/mysql /usr/include/mysql /var/spool/mail/mysql /usr/lib/mysql[root@zendlinux ~]# find / -name mysql
Delete some configuration files
The configuration files include/etc/my. cnf or/etc/init. d/mysqld, depending on the specific installation configuration.
[root@zendlinux ~]# rm -rf /etc/my.cnf[root@zendlinux ~]# rm -rf /etc/init.d/mysqld
Delete MySQL users and user groups
[root@zendlinux ~]# id mysqluid=500(mysql) gid=500(mysql) groups=500(mysql)[root@zendlinux ~]# userdel mysql[root@zendlinux ~]# id mysql