之前一直用RHEL 6.3和6.4,系統盤裏自帶了mysql server,配置好yum源後,直接yum install mysql-server就可安裝mysql服務器端了,最近用CentOS 7.1,發現系統盤沒有提供mysql-server的RPM包,在網上搜羅了半天,最後在mysql的官方網站找到答案。
只需在/etc/yum.repos.d/目錄下添加如下文件mysql-community.repo文件,內容以下:
mysql
# Enable to use MySQL 5.6 [mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
以上對應的是5.6版本。
5.7版本的內容以下:
sql
# Note: MySQL 5.7 is currently in development. For use at your own risk. # Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/ [mysql57-community-dmr] name=MySQL 5.7 Community Server Development Milestone Release baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
最後執行
服務器
yum install mysql-community-server
便可。
我用的是5.6版本的內容,在安裝的過程當中,報如下錯誤:
curl
GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql"
很顯然,本地沒有RPM-GPG-KEY-mysql文件,因而對上文的mysql-community.repo作了一下修改,修改後的內容以下:
網站
[mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/5/$basearch/ enabled=1 gpgcheck=0
從新執行
url
yum install mysql-community-server
命令,安裝OK~server