一、停止mysql服务
service mysqld stop
二、llinux查询mysql文件
rpm -qa|grep -i mysql
[root@localhost /]# rpm -qa|grep -i mysql mysql-community-server-8.0.11-1.el7.x86_64 mysql-community-common-8.0.11-1.el7.x86_64 mysql-community-client-8.0.11-1.el7.x86_64 mysql-community-libs-8.0.11-1.el7.x86_64
三、执行命令
yum remove mysql-libs --需要装载yum 包管理器
四、出现报错
[root@localhost /]# yum remove mysql-libs 已加载插件:fastestmirror, langpacks 正在解决依赖关系 There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help). --> 正在检查事务 ---> 软件包 mysql-community-libs.x86_64.0.8.0.11-1.el7 将被 删除 --> 正在处理依赖关系 mysql-community-libs(x86-64) >= 8.0.0,它被软件包 mysql-community-client-8.0.11-1.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 mysql-community-client.x86_64.0.8.0.11-1.el7 将被 删除 --> 正在处理依赖关系 mysql-community-client(x86-64) >= 8.0.0,它被软件包 mysql-community-server-8.0.11-1.el7.x86_64 需要 --> 正在检查事务 ---> 软件包 mysql-community-server.x86_64.0.8.0.11-1.el7 将被 删除 --> 解决依赖关系完成 依赖关系解决 =================================================================================================================================================================================================================== Package 架构 版本 源 大小 =================================================================================================================================================================================================================== 正在删除: mysql-community-libs x86_64 8.0.11-1.el7 installed 11 M 为依赖而移除: mysql-community-client x86_64 8.0.11-1.el7 installed 120 M mysql-community-server x86_64 8.0.11-1.el7 installed 1.5 G 事务概要 =================================================================================================================================================================================================================== 移除 1 软件包 (+2 依赖软件包) 安装大小:1.6 G 是否继续?[y/N]:y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction 警告:RPM 数据库已被非 yum 程序修改。
一直卡在这里没有办法删除:
提示:
%preun(mysql-community-server-8.0.11-1.el7.x86_64) 脚本执行失败,捕捉到信号:
2、Error in PREUN scriptlet in rpm package mysql-community-server-8.0.11-1.el7.x86_64
五、解决办法:
yum --setopt=tsflags=noscripts remove +删不掉的依赖包名
例:
yum --setopt=tsflags=noscripts remove mysql-community-server-8.0.11-1.el7.x86_64



