Linux

無法在 CentOS 6.6 上安裝 MySQL 伺服器

  • May 20, 2015

我嘗試了以下命令

[root@n yum.repos.d]# rpm -qa | grep mysql  
mysql-libs-5.1.73-3.el6_5.x86_64  
mysql-community-release-fc21-5.noarch  
[root@n yum.repos.d]# 

但我給出了以下命令

[root@n yum.repos.d]# yum remove mysql   
Setting up Remove Process   
No Match for argument: mysql       
Package(s) mysql available, but not installed.      
No Packages marked for removal        
[root@n yum.repos.d]#

我試圖安裝 mysql 但它顯示以下錯誤

[root@n yum.repos.d]# rpm -ivh http://repo.mysql.com/mysql-community-release-el5-5.noarch.rpm   
Retrieving http://repo.mysql.com/mysql-community-release-el5-5.noarch.rpm  
Preparing...                ########################################### [100%]  
       package mysql-community-release-fc21-5.noarch (which is newer than   mysql-community-release-el5-5.noarch) is already installed  
       file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql from install of mysql-community-release-el5-5.noarch conflicts with file from package mysql-community-release-fc21-5.noarch    
       file /etc/yum.repos.d/mysql-community-source.repo from install of mysql-community-release-el5-5.noarch conflicts with file from package mysql-community-release-fc21-5.noarch     
       file /etc/yum.repos.d/mysql-community.repo from install of mysql- community-release-el5-5.noarch conflicts with file from package mysql- community-release-fc21-5.noarch 

[root@n yum.repos.d]# dir  
CentOS-Base.repo       CentOS-Vault.repo  
CentOS-Debuginfo.repo  epel.repo  
CentOS-fasttrack.repo  epel-testing.repo  
CentOS-Media.repo      mysql-community-release-el6-5.noarch.rpm  
[root@n yum.repos.d]#  

任何人都可以幫助解決這個問題嗎?

你一開始就不應該安裝mysql-community-release-fc21-5.noarch。該 RPM 清楚地標明它適用於 fedora core 21。

yum erase mysql-community-release-fc21-5.noarch.

接下來,您嘗試安裝mysql-community-release-el5-5.noarch.rpm. 這樣做,你就會回到你開始的地方,但錯誤消息略有不同。該 RPM 清楚地標明它是用於 el5 (CentOS 5.x RHEL 5.x)。

官方文件說的很清楚,需要下載標有el6的那個。

For an EL6-based system, the command is in the form of:

shell> sudo yum localinstall mysql-community-release-el6-{version-number}.noarch.rpm  

引用自:https://serverfault.com/questions/693286