CentOS6.5にMySQL5.7をインストールする


### リポジトリを追加

リポジトリは[mysqlの公式のyumリポジトリ](http://dev.mysql.com/downloads/repo/yum/)で確認してください。
(※ 今回のはcentos6用なので、centos7の場合は別です)

```
# yum localinstall http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm
Loaded plugins: fastestmirror, security
Setting up Local Package Process
mysql57-community-release-el6-8.noarch.rpm                                                                                                                                | 8.9 kB     00:00
Examining /var/tmp/yum-root-sWSouw/mysql57-community-release-el6-8.noarch.rpm: mysql57-community-release-el6-8.noarch
Marking /var/tmp/yum-root-sWSouw/mysql57-community-release-el6-8.noarch.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el6-8 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================
 Package                                             Arch                             Version                            Repository                                                         Size
=================================================================================================================================================================================================
Installing:
 mysql57-community-release                           noarch                           el6-8                              /mysql57-community-release-el6-8.noarch                           8.2 k

Transaction Summary
=================================================================================================================================================================================================
Install       1 Package(s)

Total size: 8.2 k
Installed size: 8.2 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : mysql57-community-release-el6-8.noarch                                                                                                                                        1/1
  Verifying  : mysql57-community-release-el6-8.noarch                                                                                                                                        1/1

Installed:
  mysql57-community-release.noarch 0:el6-8

Complete!
```

## ちゃんとリポジトリが追加されてるか

```
# yum repolist
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
repo id                                                                                      repo name                                                                                     status
base                                                                                         CentOS-6 - Base                                                                               6,696
extras                                                                                       CentOS-6 - Extras                                                                                62
jenkins                                                                                      Jenkins                                                                                         352
mysql-connectors-community                                                                   MySQL Connectors Community                                                                       21
mysql-tools-community                                                                        MySQL Tools Community                                                                            38
mysql57-community                                                                            MySQL 5.7 Community Server                                                                      130
updates                                                                                      CentOS-6 - Updates                                                                              478
repolist: 7,777
```

`mysql57-community`が追加されてます。

## インストールしてみる

```bash
# yum install --enablerepo=mysql57-community mysql-community-server

途中でこれでOKか聞かれるが、`y`で。

Installed:
  mysql-community-server.x86_64 0:5.7.15-1.el6

Dependency Installed:
  mysql-community-client.x86_64 0:5.7.15-1.el6                    mysql-community-common.x86_64 0:5.7.15-1.el6                    mysql-community-libs.x86_64 0:5.7.15-1.el6

Complete!
```

## 起動

```
# service mysqld start
MySQL データベースを初期化中:                              [  OK  ]
Installing validate password plugin:                       [  OK  ]
mysqld を起動中:                                           [  OK  ]
```

## 初期設定

mysql5.7ではセキュリティが強化され、初期設定で良しなにやってくれるようになりました。
その辺は私の以前の記事([MySQL5.7の初期設定まとめ
](http://qiita.com/ritukiii/items/08df5be6d50871124aaf))を参考にしてください。