由于与 mariadb 冲突,mysql 无法在 CentOS 中安装

Posted

技术标签:

【中文标题】由于与 mariadb 冲突,mysql 无法在 CentOS 中安装【英文标题】:mysql wont install in CentOS due to conflict with mariadb 【发布时间】:2015-01-22 16:30:57 【问题描述】:

我刚刚安装了CentOS linux,然后下载了 mysql tar 文件来安装 MySQL。我提取了 6 个随附的 rpm 文件,然后单击 -server rpm 文件进行安装。但我收到以下对话框错误:

Failed to install file  
Two packages provide the same name.  
This is usually due to mixing packages from different software sources.  

当我尝试从 linux 终端运行 install 它时,我得到以下更具体的日志,这似乎表明与 mariadb 冲突:

[root@localhost ~]# yum install /path/to/Downloads/MySQL-server-5.6.21-1.linux_glibc2.5.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining /path/to/Downloads/MySQL-server-5.6.21-1.linux_glibc2.5.x86_64.rpm: MySQL-server-5.6.21-1.linux_glibc2.5.x86_64
Marking /path/to/Downloads/MySQL-server-5.6.21-1.linux_glibc2.5.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package MySQL-server.x86_64 0:5.6.21-1.linux_glibc2.5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:

MySQL 服务器 x86_64 5.6.21-1.linux_glibc2.5 /MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 253 M

Transaction Summary
================================================================================
Install 1 Package

Total size: 253 M
Installed size: 253 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test

Transaction check error:
file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.21-1.linux_glibc2.5.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64

Error Summary
-------------

如何解决此错误?

我是linux 的新手,尽管我已经在 Windows 中使用 MySQL 很长时间了。这是linux 的全新安装,这是我要安装的第一个软件,所以我能想象的唯一预先存在的软件将是捆绑在CentOS 7 中的东西。显然 MariaDB 预装在 CentOS 7 中,但是我该如何处理呢?

我在 oracle 网站上找到了this bug report,但我不知道该怎么做,因为我是 linux 的新手。

【问题讨论】:

你已经安装了mysql包吗? rpm -qa mysql* 说什么? @EtanReisner 我刚刚打开terminal 并输入rpm -qa mysql* 然后回车。它只是给出了另一个命令提示符,没有其他信息。 运行yum install <the -server rpm file you clicked on>会得到什么? @EtanReisner 它说我需要成为 root 才能执行此命令。我有root密码,但是如何以root身份打开终端? 可能有一个菜单项。或者试试sudo yum ...(我不知道CentOS是否在此时默认设置)。如果这不起作用,那么您可以运行 su - 以获取 root shell,然后运行 ​​yum 命令。 【参考方案1】:

以下对我有用。

$yum 外壳

删除 mariadb-libs

运行

退出,然后安装 MYSQL RPM 包。

从以下帖子中得到想法 https://serverfault.com/questions/613366/install-mysql-on-centos7-with-rpm

【讨论】:

感谢您和 +1 抽出宝贵时间回复这个老问题。我无法验证您的回答。但是,如果其他人想要验证您的答案并发表评论,我很乐意将您的答案标记为已接受。 在 RHEL 7 上安装 MySQL 5.6.51 时得到完全相同的错误消息。尽管我必须以 root 身份运行才能删除 mariadb-libs,但效果很好。【参考方案2】:

对我有用的替代解决方案:

搜索损坏的包包:(例如 mariadb-libs)

$ rpm -qa | grep mariadb-libs
mariadb-libs-5.5.52-1.el7.x86_64

删除这个包:

rpm -ev --nodeps mariadb-libs-5.5.52-1.el7.x86_64

现在只需安装 mysql rpm 或 mysql-server。 希望它能解决损坏包相关问题的任何依赖。

【讨论】:

我就是这种情况。【参考方案3】:

运行yum erase MariaDB* 命令对我有用。

【讨论】:

【参考方案4】:

喜欢 xs2raid 的回答

如果 MariaDB 的包是其他已安装包的依赖项,您可以这样做

yum shell
> remove MariaDB-common
> install percona-server-server percona-server-shared-compat
> run

这样,您可以在安装 percona 软件包时删除 MariaDB 项目,而不会强制您卸载依赖于 MariaDB-common 的软件包,例如

【讨论】:

以上是关于由于与 mariadb 冲突,mysql 无法在 CentOS 中安装的主要内容,如果未能解决你的问题,请参考以下文章

如何解决 Mariadb 与 mysql 的冲突以安装 mySQL-python 依赖项

mysql双主安装

mariadb无法生成run/mysqld

MariaDB 用户与权限管理(12)

MariaDB 备份与日志管理(13)

MariaDB 连接查询与子查询