[CentOS, MySQL] yumでCentOS7系にMySQL5.6系をインストール

### ダウンロードとインストール

MySQLからレポジトリをさがす

http://dev.mysql.com/downloads/repo/yum/

今回は、CentOS7なので、el7を使う。

```shell-session:console
# yum install http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

# cat /etc/yum.repos.d/mysql-community.repo
（適当なレポジトリ名を探す）

# yum list --enablerepo=mysql56-community | grep mysql
（mysql-community系だけ抜粋）

mysql-community-release.noarch              el7-5                      @/mysql-community-release-el7-5.noarch
mysql-community-bench.x86_64                5.6.20-4.el7               mysql56-community
mysql-community-client.i686                 5.6.20-4.el7               mysql56-community
mysql-community-client.x86_64               5.6.20-4.el7               mysql56-community
mysql-community-common.i686                 5.6.20-4.el7               mysql56-community
mysql-community-common.x86_64               5.6.20-4.el7               mysql56-community
mysql-community-devel.i686                  5.6.20-4.el7               mysql56-community
mysql-community-devel.x86_64                5.6.20-4.el7               mysql56-community
mysql-community-embedded.i686               5.6.20-4.el7               mysql56-community
mysql-community-embedded.x86_64             5.6.20-4.el7               mysql56-community
mysql-community-embedded-devel.i686         5.6.20-4.el7               mysql56-community
mysql-community-embedded-devel.x86_64       5.6.20-4.el7               mysql56-community
mysql-community-libs.i686                   5.6.20-4.el7               mysql56-community
mysql-community-libs.x86_64                 5.6.20-4.el7               mysql56-community
mysql-community-server.x86_64               5.6.20-4.el7               mysql56-community
mysql-community-test.x86_64                 5.6.20-4.el7               mysql56-community
mysql-connector-odbc.x86_64                 5.3.4-1.el7                mysql-connectors-community
mysql-connector-python.noarch               1.2.2-1.el7                mysql-connectors-community
mysql-utilities.noarch                      1.4.4-1.el7                mysql-tools-community
mysql-utilities-extra.noarch                1.4.4-1.el7                mysql-tools-community

（32bitならi686系を、64bitならx86_64系を）

# yum install --enablerepo=mysql56-community mysql-community-client.x86_64 mysql-community-devel.x86_64 mysql-community-server.x86_64

Dependencies Resolved

================================================================================================================================
 Package                               Arch                 Version                       Repository                       Size
================================================================================================================================
Installing:
 mysql-community-client                x86_64               5.6.20-4.el7                  mysql56-community                19 M
 mysql-community-devel                 x86_64               5.6.20-4.el7                  mysql56-community               3.4 M
 mysql-community-libs                  x86_64               5.6.20-4.el7                  mysql56-community               2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.37-1.el7_0
 mysql-community-server                x86_64               5.6.20-4.el7                  mysql56-community                57 M
Installing for dependencies:
 mysql-community-common                x86_64               5.6.20-4.el7                  mysql56-community               248 k
 perl-Compress-Raw-Bzip2               x86_64               2.061-3.el7                   base                             32 k
 perl-Compress-Raw-Zlib                x86_64               1:2.061-4.el7                 base                             57 k
 perl-DBI                              x86_64               1.627-4.el7                   base                            802 k
 perl-IO-Compress                      noarch               2.061-2.el7                   base                            260 k
 perl-Net-Daemon                       noarch               0.48-5.el7                    base                             51 k
 perl-PlRPC                            noarch               0.2020-14.el7                 base                             36 k

Transaction Summary
================================================================================================================================
Install  4 Packages (+7 Dependent packages)

Total download size: 83 M
Is this ok [y/d/N]:

Installed:
  mysql-community-client.x86_64 0:5.6.20-4.el7                   mysql-community-devel.x86_64 0:5.6.20-4.el7
  mysql-community-libs.x86_64 0:5.6.20-4.el7                     mysql-community-server.x86_64 0:5.6.20-4.el7

Dependency Installed:
  mysql-community-common.x86_64 0:5.6.20-4.el7                   perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7                    perl-DBI.x86_64 0:1.627-4.el7
  perl-IO-Compress.noarch 0:2.061-2.el7                          perl-Net-Daemon.noarch 0:0.48-5.el7
  perl-PlRPC.noarch 0:0.2020-14.el7

Replaced:
  mariadb-libs.x86_64 1:5.5.37-1.el7_0

Complete!

# mysql --version
mysql  Ver 14.14 Distrib 5.6.20, for Linux (x86_64) using  EditLine wrapper
```

CentOS7から、標準でMariaDBがインストールできます。
ので、MySQLをインストールしようとすると競合するので注意。
参考：[ubuntuにMariaDBをインストールしてみた](http://qiita.com/pb_tmz08/items/9cddfccc6615d1a089f2)

あとは、[このへん](http://qiita.com/search?utf8=%E2%9C%93&sort=rel&q=mysql)みたりして、初期設定をしてください。



### 2015-09-18 追記

@ma_me さんの記事をリンクしました
[Centos7でmysql のインストールとインストール時のエラー対処](http://qiita.com/ma_me/items/ae449ad8a2c424665310)