Completely clean uninstall MySQL under CentOS6.8

Source: Internet
Author: User

Source organized in Https://www.cnblogs.com/wanghuaijun/p/6398240.html

Under Virtual machine CentOS6.8

Run the command first to see if the directory exists in the MySQL folder: Cd/usr/local re-enter LL

If there is

Execute the Delete command rm-rf/usr/local/mysql

Again

Empty all directories and files related to MySQL
Rm-rf/usr/lib/mysql
Rm-rf/usr/share/mysql

Rm-rf/usr/my.cnf

Delete MySQL Service

[Email protected] local]# Chkconfig--list | Grep-i MySQL
[[email protected] local]# chkconfig--del MySQL

Yum-style installation of MySQL

1. Yum remove MySQL mysql-server mysql-libs compat-mysql51

2, Rm-rf/var/lib/mysql

3, RM/ETC/MY.CNF

See if you have MySQL software:
Rpm-qa|grep MySQL

If it exists, continue with the deletion.

RPM-style installation of MySQL

A) Check to see if MySQL is installed in the RPM package on the system:

[Email protected] opt]# Rpm-qa | Grep-i MySQL
mysql-server-5.6.17-1.el6.i686
mysql-client-5.6.17-1.el6.i686

b) Uninstall MySQL

[Email protected] local]# rpm-e mysql-server-5.6.17-1.el6.i686
[Email protected] local]# rpm-e mysql-client-5.6.17-1.el6.i686

c) Delete MySQL service

[Email protected] local]# Chkconfig--list | Grep-i MySQL
[[email protected] local]# chkconfig--del MySQL

d) Delete the distributed MySQL folder

[[email protected] local]# Whereis MySQL or find/-name MySQL

MySQL:/usr/lib/mysql/usr/share/mysql

Empty all directories and files related to MySQL
Rm-rf/usr/lib/mysql
Rm-rf/usr/share/mysql

Rm-rf/usr/my.cnf

This article introduces several ways to completely uninstall MySQL under CentOS, and share it with you, as follows:

1: Check if MySQL is installed:

Mode 1:

?
1234567891011 [[email protected] usr] # Yum List installed mysql* loaded plugins:fastestmirror Loading mirror speeds from cached hostfile   * base:mirrors.yun-idc.com   * Extras: mirror.neu.edu.cn   * updates: mirrors.yun-idc.com installed Packages mysql-client.x86_64  5.6.27-1.el6  installed mysql-devel.x86_64  5.6.27-1.el6  installed mysql-server.x86_64  5.6.27-1.el6  Installed [[email protected] usr] #

Method 2 (-I: Case insensitive):

?
12345 [[email protected] usr]# rpm -qa | grep -i mysqlMySQL-server-5.6.27-1.el6.x86_64MySQL-client-5.6.27-1.el6.x86_64MySQL-devel-5.6.27-1.el6.x86_64[[email protected] usr]#

2: Uninstall MySQL:

Uninstall 1:

?
123 [roo[email protected] usr]# yum remove mysql mysql-server mysql-libs compat-mysql51[[email protected] usr]# rm -rf /var/lib/mysql[[email protected] usr]# rm /etc/my.cnf

If the Mysql-devel (other add command) is installed, uninstall as:

Copy CodeThe code is as follows:
[[Email Protected]_ts_tian init.d]# yum remove MySQL mysql-devel mysql-server mysql-libs compat-mysql51

Note (for example):

Mysql-5.5.39-1.el6.remi.x86_64
Mysql-libs-5.5.39-1.el6.remi.x86_64
Compat-mysql51-5.1.54-1.el6.remi.x86_64
Mysql-server-5.5.39-1.el6.remi.x86_64

Uninstall 2{continue, 1, 2 Select one (here for introduction):}:

?
123456789 [[email protected] mysql] # rpm -aq | grep-i MySQL mysql-server-5.6.27-1.el6.x86_64 mysql-client-5.6.27-1.el6.x86_64 mysql-devel-5.6.27-1.el6.x86_64 [[email protected] mysql] # rpm-e mysql-server-5.6.27-1.el6.x86_64 [[email protected] MySQL] # rpm-e mysql-client-5.6.27-1.el6.x86_64 [[email protected] MySQL] # rpm-e mysql-devel-5.6.27-1.el6.x86_64 [[email protected] rc.d] # cd/var/lib/ [[email protected] lib] # rm-rf mysql/

Note: Delete the MySQL database directory (critical), otherwise password is not updated (default installation, if the custom installation path and link path ln-s ... Please delete. )
Rm-rf/var/lib/mysql

Uninstall 3:

?
123 [[email protected] usr]# whereis mysqlmysql: /usr/lib64/mysql[[email protected] usr]# rm -rf /usr/lib64/mysql

Note: Find/-name MySQL

Note: Empty all directories related to MySQL, as well as files and other configuration and settings. If so, then delete. It is also important to consider other software that does not affect.

Rm-rf/usr/lib/mysql

Rm-rf/usr/share/mysql

Uninstall 4:

?
12 [[email protected] usr]# rm –rf /usr/my.cnf[[email protected] usr]# rm -rf /root/.mysql_sercret

Uninstall 5 (Auto-start service):

?
12 [[email protected] usr]# chkconfig --list | grep -i mysql[[email protected] usr]# chkconfig --del mysqld

Delete here to see your own settings: mysql/mysqld

Completely clean uninstall MySQL under CentOS6.8

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.