日期:2014-05-16  浏览次数:20432 次

Linux下删除卸载系统自带的MySQL数据库

近期由于工作需要,加上偶上辈子修来的福分,让偶一个坐coder的,去linux下配置运行环境。故,经历了些事,且总结了点东东,今晚有机会写下点东东,与各位分享一下...

?

?

有关如何在linux下安装mysql,可以参考我的另一篇博文 http://syc001.iteye.com/blog/1151858

?

/*****----------------? Uninstall Linux installed mysql begin? -------------------*****/

由于redhat Enterprise 5 中自带一个mysql的版本,如果在安装linux前未选择mysql的安装此步就可跳过,因为我当时安装了现在将其卸载,步骤如下:

?

?????? a. 查找已安装的myslq 版本:

??????? #rpm? -qa | grep? mysql (注意大小写,如果mysql 不行就换MySQL)

?

出现:

[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

?

卸载命令:

//卸载已安装的mysql
# rpm –e mysql-*

?

卸载后/var/lib/mysql中的数据及/etc/my.cnf不会删除,如果确定没用后就手工删除

  rm -f /etc/my.cnf

  rm -rf /var/lib/mysql

?

或者,参考

(系统 CentOS4.3
安装方法 #yum -y install mysql-server
mysql版本 mysql-server.i386-4.1.20-1.RHEL4.1
删除方法 #yum -y remove mysql-server
???????? #yum -y remove mysql

?

?

后,在输入命令:

[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:5.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-py