CentOS 7中如何安裝MySQL Server

來源:互聯網
上載者:User

CentOS 7中如何安裝MySQL Server

以前一直用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檔案,內容如下:

# 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版本的內容如下:

# 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版本的內容,在安裝的過程中,報以下錯誤:

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

重新執行yum install mysql-community-server命令,安裝OK~

以下是小編為您精心挑選的MySQL相關內容,看看是否有所協助:

Linux下安裝編譯MySQL5.5.28 

Linux下MySQL 5.6.23安裝 

CentOS 7下源碼安裝MySQL 5.6 

MySQL5.7.3.0安裝配置圖解教程

Ubuntu 14.04下安裝MySQL

《MySQL權威指南(原書第2版)》清晰中文掃描版 PDF

Ubuntu 14.04 LTS 安裝 LNMP Nginx\PHP5 (PHP-FPM)\MySQL

Ubuntu 14.04下搭建MySQL主從伺服器

Ubuntu 12.04 LTS 構建高可用分布式 MySQL 叢集

Ubuntu 12.04下原始碼安裝MySQL5.6以及Python-MySQLdb

MySQL-5.5.38通用二進位安裝

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.