centos7安装mariadb出现依赖问题的解决

Posted 峰哥ge

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装mariadb出现依赖问题的解决相关的知识,希望对你有一定的参考价值。

今天我想安装mariadb-server服务,但是突然间报了这么多错误。

[root@chaofeng ~]# yum install mariadb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
 * webtatic: us-east.repo.webtatic.com
Resolving Dependencies
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).
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package mariadb-server.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: mariadb(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.64-1.el7 will be installed
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Conflict: MariaDB-compat-10.2.31-1.el7.centos.x86_64 conflicts mariadb-libs < 1:10.1.0
Removing mariadb-libs.x86_64 1:5.5.64-1.el7 - u due to obsoletes from installed MariaDB-compat-10.2.31-1.el7.centos.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-5.5.64-1.el7.x86_64
--> Finished Dependency Resolution
Error: MariaDB-compat conflicts with 1:mariadb-libs-5.5.64-1.el7.x86_64
Error: Package: 1:mariadb-server-5.5.64-1.el7.x86_64 (base)
           Requires: mariadb-libs(x86-64) = 1:5.5.64-1.el7
           Installed: MariaDB-compat-10.2.31-1.el7.centos.x86_64 (@mariadb)
               mariadb-libs(x86-64) = 1:10.1.38-1.el7.centos
Error: Package: 1:mariadb-5.5.64-1.el7.x86_64 (base)
           Requires: mariadb-libs(x86-64) = 1:5.5.64-1.el7
           Installed: MariaDB-compat-10.2.31-1.el7.centos.x86_64 (@mariadb)
               mariadb-libs(x86-64) = 1:10.1.38-1.el7.centos
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

报了这么多错误,我也是花费了大量的心思去解决,可是总是不尽人意,还是报错误,突然见我又仔细的查看一下错误的原因,细心一点才发现自己解决错了放心。

大家来看上面的青色背景的话,猛地一看这么多,脑子都懵逼了。不过想要解决,我们得自己慢慢研究才行

仔细一看其实最主要的愿意是青色背景的第一行,也就是这个

Error: MariaDB-compat conflicts with 1:mariadb-libs-5.5.64-1.el7.x86_64

说白了就是MariaDB-compat这个包和mariadb-libs这个包发生了冲突,既然发生了冲突,我们就要看看安装这个mariadb-server的时候,它需要的是这两个冲突包其中的哪个包,仔细一看

 

 不难发现,mariab-server需要安装的是mariadb-libs这个包,但是安装这个包的时候发现“Installed”,也就是后面的MariaDB-compat这个包已经存在系统上面了,那么解决的方法就是把MariaDB-compat给卸载了。

现在我搜索一下

[root@chaofeng ~]# rpm -qa | grep MariaDB
MariaDB-common-10.2.31-1.el7.centos.x86_64
MariaDB-compat-10.2.31-1.el7.centos.x86_64

发现有两个包,那我干脆两个都直接卸载算了。我使用这种方法居然还不行

[root@chaofeng ~]# rpm -qa | grep MariaDB | xargs rpm -e
error: Failed dependencies:
    libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
    libmysqlclient.so.18()(64bit) is needed by (installed) zabbix-server-mysql-4.4.6-1.el7.x86_64
    libmysqlclient.so.18()(64bit) is needed by (installed) perl-DBD-MySQL-4.023-6.el7.x86_64
    libmysqlclient.so.18()(64bit) is needed by (installed) zabbix-proxy-mysql-4.4.7-1.el7.x86_64
    libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-7.el7.x86_64
    libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) zabbix-server-mysql-4.4.6-1.el7.x86_64
    libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) perl-DBD-MySQL-4.023-6.el7.x86_64
    libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) zabbix-proxy-mysql-4.4.7-1.el7.x86_64

原来是卸载的包之间也是有依赖的,所以卸载的时候有一个先后顺序,

[root@chaofeng ~]# rpm -e MariaDB-compat-10.2.31-1.el7.centos.x86_64 --force
rpm: only installation and upgrading may be forced

接着卸载另一个

[root@chaofeng ~]# rpm -e MariaDB-common-10.2.31-1.el7.centos.x86_64

两个都卸载完毕了。这样子就清楚了

终于可以安装mariadb-server了

[root@chaofeng ~]# yum install mariadb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
 * webtatic: us-east.repo.webtatic.com
Resolving Dependencies
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).
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package mariadb-server.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Processing Dependency: mariadb(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-server-5.5.64-1.el7.x86_64
--> Running transaction check
---> Package mariadb.x86_64 1:5.5.64-1.el7 will be installed
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================
 Package                                  Arch                             Version                                    Repository                      Size
===========================================================================================================================================================
Installing:
 mariadb-server                           x86_64                           1:5.5.64-1.el7                             base                            11 M
Installing for dependencies:
 mariadb                                  x86_64                           1:5.5.64-1.el7                             base                           8.7 M
 mariadb-libs                             x86_64                           1:5.5.64-1.el7                             base                           759 k

Transaction Summary
===========================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 21 M
Installed size: 111 M
Is this ok [y/d/N]: 

真是美滋滋。

 

以上是关于centos7安装mariadb出现依赖问题的解决的主要内容,如果未能解决你的问题,请参考以下文章

centos7安装mariadb10遇到的问题解决

Failed to start mysqld.service: Unit not found

centos7.4下源码安装mariadb

centos7环境下在线安装mysql

centos7源码编译安装mariadb

centos7安装数据库 (系统包含预装环境mariadb)