MySQL 5.7 のインストール(Linux)

はじめに

この手順では、CentOS 7 系に MySQL 5.7 をインストールする手順を説明します。

以下の説明の中で実行している各コマンドはroot権限を持つユーザーで入力してください。

1.MySQL のインストール

MySQL のRPMパッケージをダウンロードページよりダウンロードします。

実行コマンド
# curl -LkvOf https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

実行結果
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* About to connect() to dev.mysql.com port 443 (#0)
*   Trying 137.254.60.11...
* Connected to dev.mysql.com (137.254.60.11) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* 	subject: CN=www.mysql.com,OU=Oracle PEO ADC,O=Oracle Corporation,L=Redwood City,ST=California,C=US
* 	start date: Feb 23 00:00:00 2018 GMT
* 	expire date: Feb 23 12:00:00 2019 GMT
* 	common name: www.mysql.com
* 	issuer: CN=DigiCert SHA2 Secure Server CA,O=DigiCert Inc,C=US
> GET /get/mysql57-community-release-el7-11.noarch.rpm HTTP/1.1
> User-Agent: curl/7.29.0
> Host: dev.mysql.com
> Accept: */*
> 
< HTTP/1.1 302 Found
< Date: Wed, 18 Apr 2018 10:40:22 GMT
< Server: Apache
< X-Frame-Options: SAMEORIGIN
< Strict-Transport-Security: max-age=15768000
< Set-Cookie: MySQL_S=au9hi4ojkg1173it769bc0lgm716h8q8; path=/; domain=mysql.com; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
< Location: https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
< 
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
* Connection #0 to host dev.mysql.com left intact
* Issue another request to this URL: 'https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm'
* About to connect() to repo.mysql.com port 443 (#1)
*   Trying 103.2.51.159...
* Connected to repo.mysql.com (103.2.51.159) port 443 (#1)
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
* 	subject: CN=cdn.mysql.com,OU=Content Management Services IT,O=Oracle Corporation,L=Redwood Shores,ST=California,C=US
* 	start date: Jul 29 00:00:00 2017 GMT
* 	expire date: Oct 28 23:59:59 2018 GMT
* 	common name: cdn.mysql.com
* 	issuer: CN=GeoTrust SSL CA - G3,O=GeoTrust Inc.,C=US
> GET //mysql57-community-release-el7-11.noarch.rpm HTTP/1.1
> User-Agent: curl/7.29.0
> Host: repo.mysql.com
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: Apache
< ETag: "c070b754ce2de9f714ab4db4736c7e05:1493312493"
< Last-Modified: Thu, 27 Apr 2017 10:45:59 GMT
< Accept-Ranges: bytes
< Content-Length: 25680
< Date: Wed, 18 Apr 2018 10:40:22 GMT
< Connection: keep-alive
< Content-Type: application/x-redhat-package-manager
< 
{ [data not shown]
100 25680  100 25680    0     0  20562      0  0:00:01  0:00:01 --:--:-- 20562
* Connection #1 to host repo.mysql.com left intact

リポジトリを登録します。

実行コマンド
# yum localinstall -y mysql57-community-release-el7-11.noarch.rpm


実行結果
Loaded plugins: fastestmirror
Examining mysql57-community-release-el7-11.noarch.rpm: mysql57-community-release-el7-11.noarch
Marking mysql57-community-release-el7-11.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================
 Package                     Arch     Version  Repository                                  Size
================================================================================================
Installing:
 mysql57-community-release   noarch   el7-11   /mysql57-community-release-el7-11.noarch    31 k

Transaction Summary
================================================================================================
Install  1 Package

Total size: 31 k
Installed size: 31 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : mysql57-community-release-el7-11.noarch                                      1/1 
  Verifying  : mysql57-community-release-el7-11.noarch                                      1/1 

Installed:
  mysql57-community-release.noarch 0:el7-11                                                     

Complete!

リポジトリが登録されていることを確認します。

実行コマンド
# yum repolist enabled | grep "mysql.*-community.*"
実行結果
mysql-connectors-community/x86_64 MySQL Connectors Community                  45
mysql-tools-community/x86_64      MySQL Tools Community                       59
mysql57-community/x86_64          MySQL 5.7 Community Server                 247

インストールします。

コマンドの実行途中で、ダウンロードとインストールの確認が求められます。画面の表示内容を確認し、問題なければ「y」を入力してインストールを進めてください。

実行コマンド
# yum install mysql-community-server
実行結果
Loaded plugins: fastestmirror
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 mysql-community-server.x86_64 0:5.7.25-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.25-1.el7 for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: perl(strict) for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: net-tools for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: /usr/bin/perl for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Processing Dependency: libaio.so.1()(64bit) for package: mysql-community-server-5.7.25-1.el7.x86_64
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
---> Package mysql-community-client.x86_64 0:5.7.25-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.25-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.25-1.el7 will be installed
---> Package net-tools.x86_64 0:2.0-0.24.20131004git.el7 will be installed
---> Package perl.x86_64 4:5.16.3-294.el7_6 will be installed
--> Processing Dependency: perl-libs = 4:5.16.3-294.el7_6 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl-libs for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-294.el7_6.x86_64
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be obsoleted
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
---> Package mysql-community-libs.x86_64 0:5.7.25-1.el7 will be obsoleting
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-4.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-libs.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package perl-macros.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.25-1.el7 will be obsoleting
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-294.el7_6 will be installed
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch   Version                  Repository         Size
================================================================================
Installing:
 mysql-community-libs   x86_64 5.7.25-1.el7             mysql57-community 2.2 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-libs-compat
                        x86_64 5.7.25-1.el7             mysql57-community 2.0 M
     replacing  mariadb-libs.x86_64 1:5.5.60-1.el7_5
 mysql-community-server x86_64 5.7.25-1.el7             mysql57-community 165 M
Installing for dependencies:
 libaio                 x86_64 0.3.109-13.el7           base               24 k
 mysql-community-client x86_64 5.7.25-1.el7             mysql57-community  24 M
 mysql-community-common x86_64 5.7.25-1.el7             mysql57-community 274 k
 net-tools              x86_64 2.0-0.24.20131004git.el7 base              306 k
 perl                   x86_64 4:5.16.3-294.el7_6       updates           8.0 M
 perl-Carp              noarch 1.26-244.el7             base               19 k
 perl-Encode            x86_64 2.51-7.el7               base              1.5 M
 perl-Exporter          noarch 5.68-3.el7               base               28 k
 perl-File-Path         noarch 2.09-2.el7               base               26 k
 perl-File-Temp         noarch 0.23.01-3.el7            base               56 k
 perl-Filter            x86_64 1.49-3.el7               base               76 k
 perl-Getopt-Long       noarch 2.40-3.el7               base               56 k
 perl-HTTP-Tiny         noarch 0.033-3.el7              base               38 k
 perl-PathTools         x86_64 3.40-5.el7               base               82 k
 perl-Pod-Escapes       noarch 1:1.04-294.el7_6         updates            51 k
 perl-Pod-Perldoc       noarch 3.20-4.el7               base               87 k
 perl-Pod-Simple        noarch 1:3.28-4.el7             base              216 k
 perl-Pod-Usage         noarch 1.63-3.el7               base               27 k
 perl-Scalar-List-Utils x86_64 1.27-248.el7             base               36 k
 perl-Socket            x86_64 2.010-4.el7              base               49 k
 perl-Storable          x86_64 2.45-3.el7               base               77 k
 perl-Text-ParseWords   noarch 3.29-4.el7               base               14 k
 perl-Time-HiRes        x86_64 4:1.9725-3.el7           base               45 k
 perl-Time-Local        noarch 1.2300-2.el7             base               24 k
 perl-constant          noarch 1.27-2.el7               base               19 k
 perl-libs              x86_64 4:5.16.3-294.el7_6       updates           688 k
 perl-macros            x86_64 4:5.16.3-294.el7_6       updates            44 k
 perl-parent            noarch 1:0.225-244.el7          base               12 k
 perl-podlators         noarch 2.5.1-3.el7              base              112 k
 perl-threads           x86_64 1.87-4.el7               base               49 k
 perl-threads-shared    x86_64 1.43-6.el7               base               39 k

Transaction Summary
================================================================================
Install  3 Packages (+31 Dependent packages)

Total download size: 205 M
Is this ok [y/d/N]: y
Downloading packages:
(1/34): libaio-0.3.109-13.el7.x86_64.rpm                   |  24 kB   00:00     
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.25-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Public key for mysql-community-common-5.7.25-1.el7.x86_64.rpm is not installed
(2/34): mysql-community-common-5.7.25-1.el7.x86_64.rpm     | 274 kB   00:00     
(3/34): mysql-community-libs-5.7.25-1.el7.x86_64.rpm       | 2.2 MB   00:00     
(4/34): mysql-community-libs-compat-5.7.25-1.el7.x86_64.rp | 2.0 MB   00:00     
(5/34): perl-Carp-1.26-244.el7.noarch.rpm                  |  19 kB   00:00     
(6/34): net-tools-2.0-0.24.20131004git.el7.x86_64.rpm      | 306 kB   00:00     
(7/34): perl-Encode-2.51-7.el7.x86_64.rpm                  | 1.5 MB   00:01     
(8/34): perl-File-Path-2.09-2.el7.noarch.rpm               |  26 kB   00:00     
(9/34): perl-File-Temp-0.23.01-3.el7.noarch.rpm            |  56 kB   00:00     
(10/34): perl-Filter-1.49-3.el7.x86_64.rpm                 |  76 kB   00:00     
(11/34): perl-Getopt-Long-2.40-3.el7.noarch.rpm            |  56 kB   00:00     
(12/34): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm             |  38 kB   00:00     
(13/34): perl-PathTools-3.40-5.el7.x86_64.rpm              |  82 kB   00:00     
(14/34): perl-5.16.3-294.el7_6.x86_64.rpm                  | 8.0 MB   00:02     
(15/34): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm            |  87 kB   00:00     
(16/34): perl-Pod-Simple-3.28-4.el7.noarch.rpm             | 216 kB   00:00     
(17/34): perl-Pod-Usage-1.63-3.el7.noarch.rpm              |  27 kB   00:00     
(18/34): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm    |  36 kB   00:00     
(19/34): perl-Socket-2.010-4.el7.x86_64.rpm                |  49 kB   00:00     
(20/34): perl-Storable-2.45-3.el7.x86_64.rpm               |  77 kB   00:00     
(21/34): perl-Text-ParseWords-3.29-4.el7.noarch.rpm        |  14 kB   00:00     
(22/34): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm           |  45 kB   00:00     
(23/34): perl-Time-Local-1.2300-2.el7.noarch.rpm           |  24 kB   00:00     
(24/34): perl-constant-1.27-2.el7.noarch.rpm               |  19 kB   00:00     
(25/34): perl-libs-5.16.3-294.el7_6.x86_64.rpm             | 688 kB   00:00     
(26/34): perl-macros-5.16.3-294.el7_6.x86_64.rpm           |  44 kB   00:00     
(27/34): perl-parent-0.225-244.el7.noarch.rpm              |  12 kB   00:00     
(28/34): perl-podlators-2.5.1-3.el7.noarch.rpm             | 112 kB   00:00     
(29/34): perl-threads-1.87-4.el7.x86_64.rpm                |  49 kB   00:00     
(30/34): perl-threads-shared-1.43-6.el7.x86_64.rpm         |  39 kB   00:00     
(31/34): mysql-community-client-5.7.25-1.el7.x86_64.rpm    |  24 MB   00:05     
(32/34): perl-Exporter-5.68-3.el7.noarch.rpm               |  28 kB   00:03     
(33/34): perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm        |  51 kB   00:04     
(34/34): mysql-community-server-5.7.25-1.el7.x86_64.rpm    | 165 MB   00:08     
--------------------------------------------------------------------------------
Total                                               22 MB/s | 205 MB  00:09     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 Package    : mysql57-community-release-el7-11.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-common-5.7.25-1.el7.x86_64                  1/35 
  Installing : mysql-community-libs-5.7.25-1.el7.x86_64                    2/35 
  Installing : mysql-community-client-5.7.25-1.el7.x86_64                  3/35 
  Installing : 1:perl-parent-0.225-244.el7.noarch                          4/35 
  Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                           5/35 
  Installing : perl-podlators-2.5.1-3.el7.noarch                           6/35 
  Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                          7/35 
  Installing : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch                    8/35 
  Installing : perl-Encode-2.51-7.el7.x86_64                               9/35 
  Installing : perl-Text-ParseWords-3.29-4.el7.noarch                     10/35 
  Installing : perl-Pod-Usage-1.63-3.el7.noarch                           11/35 
  Installing : 4:perl-libs-5.16.3-294.el7_6.x86_64                        12/35 
  Installing : 4:perl-macros-5.16.3-294.el7_6.x86_64                      13/35 
  Installing : perl-Storable-2.45-3.el7.x86_64                            14/35 
  Installing : perl-Exporter-5.68-3.el7.noarch                            15/35 
  Installing : perl-constant-1.27-2.el7.noarch                            16/35 
  Installing : perl-Time-Local-1.2300-2.el7.noarch                        17/35 
  Installing : perl-Socket-2.010-4.el7.x86_64                             18/35 
  Installing : perl-Carp-1.26-244.el7.noarch                              19/35 
  Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                      20/35 
  Installing : perl-PathTools-3.40-5.el7.x86_64                           21/35 
  Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                 22/35 
  Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                        23/35 
  Installing : perl-File-Temp-0.23.01-3.el7.noarch                        24/35 
  Installing : perl-File-Path-2.09-2.el7.noarch                           25/35 
  Installing : perl-threads-shared-1.43-6.el7.x86_64                      26/35 
  Installing : perl-threads-1.87-4.el7.x86_64                             27/35 
  Installing : perl-Filter-1.49-3.el7.x86_64                              28/35 
  Installing : perl-Getopt-Long-2.40-3.el7.noarch                         29/35 
  Installing : 4:perl-5.16.3-294.el7_6.x86_64                             30/35 
  Installing : net-tools-2.0-0.24.20131004git.el7.x86_64                  31/35 
  Installing : libaio-0.3.109-13.el7.x86_64                               32/35 
  Installing : mysql-community-server-5.7.25-1.el7.x86_64                 33/35 
  Installing : mysql-community-libs-compat-5.7.25-1.el7.x86_64            34/35 
  Erasing    : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                       35/35 
  Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                           1/35 
  Verifying  : mysql-community-common-5.7.25-1.el7.x86_64                  2/35 
  Verifying  : perl-threads-shared-1.43-6.el7.x86_64                       3/35 
  Verifying  : perl-Storable-2.45-3.el7.x86_64                             4/35 
  Verifying  : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch                    5/35 
  Verifying  : perl-Exporter-5.68-3.el7.noarch                             6/35 
  Verifying  : perl-constant-1.27-2.el7.noarch                             7/35 
  Verifying  : perl-PathTools-3.40-5.el7.x86_64                            8/35 
  Verifying  : 1:perl-parent-0.225-244.el7.noarch                          9/35 
  Verifying  : 4:perl-libs-5.16.3-294.el7_6.x86_64                        10/35 
  Verifying  : mysql-community-client-5.7.25-1.el7.x86_64                 11/35 
  Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                        12/35 
  Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                        13/35 
  Verifying  : perl-Time-Local-1.2300-2.el7.noarch                        14/35 
  Verifying  : libaio-0.3.109-13.el7.x86_64                               15/35 
  Verifying  : 4:perl-macros-5.16.3-294.el7_6.x86_64                      16/35 
  Verifying  : perl-Socket-2.010-4.el7.x86_64                             17/35 
  Verifying  : perl-Carp-1.26-244.el7.noarch                              18/35 
  Verifying  : net-tools-2.0-0.24.20131004git.el7.x86_64                  19/35 
  Verifying  : mysql-community-server-5.7.25-1.el7.x86_64                 20/35 
  Verifying  : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                      21/35 
  Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                 22/35 
  Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                           23/35 
  Verifying  : perl-Encode-2.51-7.el7.x86_64                              24/35 
  Verifying  : mysql-community-libs-5.7.25-1.el7.x86_64                   25/35 
  Verifying  : mysql-community-libs-compat-5.7.25-1.el7.x86_64            26/35 
  Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                         27/35 
  Verifying  : perl-podlators-2.5.1-3.el7.noarch                          28/35 
  Verifying  : perl-File-Path-2.09-2.el7.noarch                           29/35 
  Verifying  : perl-threads-1.87-4.el7.x86_64                             30/35 
  Verifying  : perl-Filter-1.49-3.el7.x86_64                              31/35 
  Verifying  : perl-Getopt-Long-2.40-3.el7.noarch                         32/35 
  Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                     33/35 
  Verifying  : 4:perl-5.16.3-294.el7_6.x86_64                             34/35 
  Verifying  : 1:mariadb-libs-5.5.60-1.el7_5.x86_64                       35/35 

Installed:
  mysql-community-libs.x86_64 0:5.7.25-1.el7                                    
  mysql-community-libs-compat.x86_64 0:5.7.25-1.el7                             
  mysql-community-server.x86_64 0:5.7.25-1.el7                                  

Dependency Installed:
  libaio.x86_64 0:0.3.109-13.el7                                                
  mysql-community-client.x86_64 0:5.7.25-1.el7                                  
  mysql-community-common.x86_64 0:5.7.25-1.el7                                  
  net-tools.x86_64 0:2.0-0.24.20131004git.el7                                   
  perl.x86_64 4:5.16.3-294.el7_6                                                
  perl-Carp.noarch 0:1.26-244.el7                                               
  perl-Encode.x86_64 0:2.51-7.el7                                               
  perl-Exporter.noarch 0:5.68-3.el7                                             
  perl-File-Path.noarch 0:2.09-2.el7                                            
  perl-File-Temp.noarch 0:0.23.01-3.el7                                         
  perl-Filter.x86_64 0:1.49-3.el7                                               
  perl-Getopt-Long.noarch 0:2.40-3.el7                                          
  perl-HTTP-Tiny.noarch 0:0.033-3.el7                                           
  perl-PathTools.x86_64 0:3.40-5.el7                                            
  perl-Pod-Escapes.noarch 1:1.04-294.el7_6                                      
  perl-Pod-Perldoc.noarch 0:3.20-4.el7                                          
  perl-Pod-Simple.noarch 1:3.28-4.el7                                           
  perl-Pod-Usage.noarch 0:1.63-3.el7                                            
  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7                                  
  perl-Socket.x86_64 0:2.010-4.el7                                              
  perl-Storable.x86_64 0:2.45-3.el7                                             
  perl-Text-ParseWords.noarch 0:3.29-4.el7                                      
  perl-Time-HiRes.x86_64 4:1.9725-3.el7                                         
  perl-Time-Local.noarch 0:1.2300-2.el7                                         
  perl-constant.noarch 0:1.27-2.el7                                             
  perl-libs.x86_64 4:5.16.3-294.el7_6                                           
  perl-macros.x86_64 4:5.16.3-294.el7_6                                         
  perl-parent.noarch 1:0.225-244.el7                                            
  perl-podlators.noarch 0:2.5.1-3.el7                                           
  perl-threads.x86_64 0:1.87-4.el7                                              
  perl-threads-shared.x86_64 0:1.43-6.el7                                       

Replaced:
  mariadb-libs.x86_64 1:5.5.60-1.el7_5                                          

Complete!


MySQL を起動します。

実行コマンド
# systemctl start mysqld && systemctl is-active mysqld
実行結果
active


ここまでで MySQL 5.7 のインストールができました。

2.セキュリティ設定

初期パスワードを確認します。

実行コマンド
# grep 'temporary password' /var/log/mysqld.log
実行結果
2018-04-18T10:47:20.952942Z 1 [Note] A temporary password is generated for root@localhost: <初期パスワード>

セキュリティ設定のウィザードにしたがって設定します。

実行コマンド
# mysql_secure_installation
実行結果
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] 
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] 
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] 
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] 
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] 
 ... Success!



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


Cleaning up...


これでインストール作業は終了です。

公式ドキュメント:2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository

リックソフト株式会社 は、日本でトップレベルのAtlassian Platinum Solution Partnerです。
大規模ユーザーへの対応実績が認められたEnterpriseの認定をうけ、高度なトレーニング要件をクリアし、小規模から大規模のお客様まで対応可能な実績を示したパートナー企業です。


Copyright © Ricksoft Co., Ltd. プライバシーポリシー お問い合わせ