Delete and uninstall MySQL from Linux

Source: Internet
Author: User
Tags dovecot

Because redhat Enterprise 5 comes with a mysql version, skip this step if you did not select mysql installation before installing linux, Because I installed it now and uninstall it as follows:
 
A. Find the installed myslq version:
# Rpm-qa | grep mysql (note the case sensitivity. If mysql doesn't work, change it to MySQL)
 
Appears:
[Ysong @ sva_rec mysql] $ rpm-qa | grep mysql
Mysql-5.0.45-7.el5
Libdbi-dbd-mysql-0.8.1a-1.2.2
Mysql-5.0.45-7.el5
Mysql-server-5.0.45-7.el5
Mysql-connector-odbc-3.51.12-2.2
 
 
Data in/var/lib/mysql and/etc/my. cnf will not be deleted after uninstallation. If it is determined that it is useless, it will be deleted manually.
Rm-f/etc/my. cnf
Rm-rf/var/lib/mysql
 
 
Then, enter the following command:
[Ysong @ sva_rec mysql] $ sudo yum-y remove mysql-5.0.45-7.el5
Password:
Loading "security" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mysql. x86_64. 0.45-7. el5 set to be erased
--> Processing Dependency: libmysqlclient. so.15 () (64bit) for package: dovecot
--> Processing Dependency: libmysqlclient. so.15 () (64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient. so.15 () (64bit) for package: mysql-connector-odbc
--> Processing Dependency: libmysqlclient. so.15 () (64bit) for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient. so.15 () (64bit) for package: libdbi-dbd-mysql
--> Processing Dependency: libmysqlclient. so.15 (libmysqlclient_15) (64bit) for package: dovecot
--> Processing Dependency: libmysqlclient. so.15 (libmysqlclient_15) (64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient. so.15 (libmysqlclient_15) (64bit) for package: mysql-connector-odbc
--> Processing Dependency: libmysqlclient. so.15 (libmysqlclient_15) (64bit) for package: perl-DBD-MySQL
--> Processing Dependency: libmysqlclient. so.15 (libmysqlclient_15) (64bit) for package: libdbi-dbd-mysql
--> Processing Dependency: libmysqlclient_r.so.15 () (64bit) for package: mysql-connector-odbc
--> Processing Dependency: libmysqlclient_r.so.15 () (64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15 () (64bit) for package: MySQL-python
--> Processing Dependency: libmysqlclient_r.so.15 (libmysqlclient_15) (64bit) for package: mysql-connector-odbc
--> Processing Dependency: libmysqlclient_r.so.15 (libmysqlclient_15) (64bit) for package: mysql-server
--> Processing Dependency: libmysqlclient_r.so.15 (libmysqlclient_15) (64bit) for package: MySQL-python
--> Processing Dependency: mysql for package: libdbi-dbd-mysql
--> Processing Dependency: mysql = 5.0.45-7. el5 for package: mysql-server
--> Processing Dependency: mysql for package: MySQL-python
---> Package mysql. i386. 0.45-7. el5 set to be erased
--> Running transaction check
---> Package mysql-server.x86_64. 0.45-7. el5 set to be erased
---> Package MySQL-python.x86_64. 2.1-1 set to be erased
---> Package libdbi-dbd-mysql.x86_64 0: 0. 8.1a-1.2.2 set to be erased
---> Package perl-DBD-MySQL.x86_64 0: 3. 0007-1.fc6 set to be erased
---> Package mysql-connector-odbc.x86_64. 51.12-2.2 set to be erased
---> Package dovecot. x86_64. 0.7-2. el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================================== ============================================
Package Arch Version Repository Size
========================================================== ============================================
Removing:
Mysql x86_64 5.0.45-7. el5 installed 7.5 M
Mysql i386 5.0.45-7. el5 installed 7.3 M
Removing for dependencies:
MySQL-python x86_64 1.2.1-1 installed 288 k
Dovecot x86_64 1.0.7-2. el5 installed 3.7 M
Libdbi-dbd-mysql x86_64 0.8.1a-1.2.2 installed 55 k
Mysql-connector-odbc x86_64 3.51.12-2.2 installed 420 k
Mysql-server x86_64 5.0.45-7. el5 installed 22 M
Perl-DBD-MySQL x86_64 3.0007-1. fc6 installed 328 k

Transaction Summary
========================================================== ============================================
Install 0 Package (s)
Update 0 Package (s)
Remove 8 Package (s)

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing: mysql-server ######################### [1/8]
Warning:/var/log/mysqld. log saved as/var/log/mysqld. log. rpmsave
Erasing: MySQL-python ######################### [2/8]
Erasing: mysql ######################## [3/8]
Erasing: libdbi-dbd-mysql ######################### [4/8]
Erasing: perl-DBD-MySQL ######################### [5/8]
Erasing: mysql-connector-odbc ######################### [6/8]
Erasing: dovecot ######################### [7/8]
Erasing: mysql ######################## [8/8]

Removed: mysql. x86_64. 0.45-7. el5 mysql. i386. 0.45-7. el5
Dependency Removed: MySQL-python.x86_64 0: 1. 2.1-1 dovecot. x86_64. 0.7-2. el5 libdbi-dbd-mysql.x86_64 0: 0. 8.1a-1.2.2 mysql-connector-odbc.x86_64 0: 3. 51.12-2.2 mysql-server.x86_64 0: 5. 0.45-7. el5 perl-DBD-MySQL.x86_64. 0007-1.fc6
Complete!
[Ysong @ sva_rec mysql] $
 
 
OK. At this point, mysql in Linux has been completely uninstalled. Then, enter:
[Ysong @ sva_rec mysql] $ rpm-qa | grep mysql
[Ysong @ sva_rec mysql] $
 
The system has no mysql service;
 
 
[Ysong @ sva_rec mysql] $ netstat-nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 127.0.0.1: 2208 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 139 0.0.0.0: * LISTEN

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.