删除centos下用yum安装的软件

发布时间:2020-12-05编辑:脚本学堂
前两天,用源码安装mysql-proxy,在编译过程中,老出错,我就依提示安装mysql,为了尽快完事,我用了yum install mysql。现在我打算重新安装mysql,因此需要把yum方式安装的mysql删除。

前两天,用源码安装mysql-proxy,在编译过程中,老出错,我就依提示安装mysql,为了尽快完事,我用了yum install mysql。
现在我打算重新安装mysql,因此需要把yum方式安装的mysql删除。
 
用rpm工具吧,不行呢,挨个删除文件,更不可行,因为我不知道究竟安装了哪些文件,都存放在哪些位置。怎么办?还好,yum自己可以完成这个工作。
 
现在来看一下yum的参数:
 

复制代码 代码如下:
[root@test1 ~]# yum
You need to give some command
usage: yum [options] < grouplist, localinstall, groupinfo, localupdate, resolvedep, erase, deplist, groupremove, makecache, upgrade, provides, shell, install, whatprovides, groupinstall, update, repolist, groupupdate, info, search, check-update, list, remove, clean, grouperase >

其中remove就是删除命令.好了,我们来执行命令 yum remove mysql ,其输出如下:
 

复制代码 代码如下:
[root@test1 ~]# yum remove mysql
Setting up Remove Process
base                      100% |=========================| 1.1 kB    00:00   
updates                   100% |=========================|  951 B    00:00   
addons                    100% |=========================|  951 B    00:00   
extras                    100% |=========================| 1.1 kB    00:00   
Resolving Dependencies
--> Running transaction check
---> Package mysql.i386 0:5.0.45-7.el5 set to be erased
--> Processing Dependency: libmysqlclient.so.15 for package: mysql-devel
--> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-devel
--> Processing Dependency: mysql = 5.0.45-7.el5 for package: mysql-devel
--> Running transaction check
---> Package mysql-devel.i386 0:5.0.45-7.el5 set to be erased
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
 mysql                   i386       5.0.45-7.el5     installed         7.3 M
Removing for dependencies:
 mysql-devel             i386       5.0.45-7.el5     installed         5.6 M
Transaction Summary
=============================================================================
Install      0 Package(s)       
Update       0 Package(s)       
Remove       2 Package(s)       
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing   : mysql-devel                  ######################### [1/2]
  Erasing   : mysql                        ######################### [2/2]
Removed: mysql.i386 0:5.0.45-7.el5
Dependency Removed: mysql-devel.i386 0:5.0.45-7.el5
Complete!

看,很容易就完成了。
再来验证一下: 执行命令mysql,其结果为:
 

复制代码 代码如下:
[root@test1 ~]# mysql
-bash: mysql: command not found

果然删除了。

本文作者:sery
转自:http://sery.blog.51cto.com/10037/91093