Google Cloud PlatformでたてたCentOS7にMySQL5.7をインストールする方法をご紹介します。
「Google Cloud Platform」と言っていますが、CentOS7では共通です。
MySQLのリポジトリインストール
公式サイトからMySQLのリポジトリをダウンロードし、インストールします。
「yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm」コマンドを実行します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
[root@gogs ~]# yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm Loaded plugins: fastestmirror mysql57-community-release-el7-10.noarch.rpm | 25 kB 00:00:00 Examining /var/tmp/yum-root-5GQXzM/mysql57-community-release-el7-10.noarch.rpm: mysql57-community-release-el7-10.no arch Marking /var/tmp/yum-root-5GQXzM/mysql57-community-release-el7-10.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql57-community-release.noarch 0:el7-10 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================== Package Arch Version Repository Size =================================================================================================================== Installing: mysql57-community-release noarch el7-10 /mysql57-community-release-el7-10.noarch 30 k Transaction Summary =================================================================================================================== Install 1 Package Total size: 30 k Installed size: 30 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql57-community-release-el7-10.noarch 1/1 Verifying : mysql57-community-release-el7-10.noarch 1/1 Installed: mysql57-community-release.noarch 0:el7-10 Complete! [root@gogs ~]# |
インストールバージョン確認
「yum info mysql-community-server」コマンドで状況確認します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
[root@gogs ~]# yum info mysql-community-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.tummy.com * epel: d2lzkl7pfhq30w.cloudfront.net * extras: mirrors.thaidns.co.th * updates: repo1.sea.innoscale.net Available Packages Name : mysql-community-server Arch : x86_64 Version : 5.7.25 Release : 1.el7 Size : 165 M Repo : mysql57-community/x86_64 Summary : A very fast and reliable SQL database server URL : http://www.mysql.com/ License : Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as : shown in the Description field. Description : The MySQL(TM) software delivers a very fast, multi-threaded, multi-user, : and robust SQL (Structured Query Language) database server. MySQL Server : is intended for mission-critical, heavy-load production systems as well : as for embedding into mass-deployed software. MySQL is a trademark of : Oracle and/or its affiliates : : The MySQL software has Dual Licensing, which means you can use the MySQL : software free of charge under the GNU General Public License : (http://www.gnu.org/licenses/). You can also purchase commercial MySQL : licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of : the GPL. See the chapter "Licensing and Support" in the manual for : further info. : : The MySQL web site (http://www.mysql.com/) provides the latest news and : information about the MySQL software. Also please see the documentation : and the manual for more information. : : This package includes the MySQL server binary as well as related utilities : to run and administer a MySQL server. [root@gogs ~]# |
インストール
「mysql57-community」のリポジトリを指定して「mysql-community-server」をインストールします。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
[root@gogs ~]# yum install --enablerepo=mysql57-community mysql-community-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.tummy.com * epel: d2lzkl7pfhq30w.cloudfront.net * extras: mirrors.thaidns.co.th * updates: repo1.sea.innoscale.net 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 --> Running transaction check ---> 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.x 86_64 ---> Package mysql-community-common.x86_64 0:5.7.25-1.el7 will be installed --> Running transaction check ---> Package mysql-community-libs.x86_64 0:5.7.25-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================== Package Arch Version Repository Size =================================================================================================================== Installing: mysql-community-server x86_64 5.7.25-1.el7 mysql57-community 165 M Installing for dependencies: 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 mysql-community-libs x86_64 5.7.25-1.el7 mysql57-community 2.2 M Transaction Summary =================================================================================================================== Install 1 Package (+3 Dependent packages) Total download size: 192 M Installed size: 863 M Is this ok [y/d/N]: y Downloading packages: (1/4): mysql-community-common-5.7.25-1.el7.x86_64.rpm | 274 kB 00:00:00 (2/4): mysql-community-libs-5.7.25-1.el7.x86_64.rpm | 2.2 MB 00:00:00 (3/4): mysql-community-client-5.7.25-1.el7.x86_64.rpm | 24 MB 00:00:00 (4/4): mysql-community-server-5.7.25-1.el7.x86_64.rpm | 165 MB 00:00:06 ------------------------------------------------------------------------------------------------------------------- Total 28 MB/s | 192 MB 00:00:06 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql-community-common-5.7.25-1.el7.x86_64 1/4 Installing : mysql-community-libs-5.7.25-1.el7.x86_64 2/4 Installing : mysql-community-client-5.7.25-1.el7.x86_64 3/4 Installing : mysql-community-server-5.7.25-1.el7.x86_64 4/4 Verifying : mysql-community-common-5.7.25-1.el7.x86_64 1/4 Verifying : mysql-community-libs-5.7.25-1.el7.x86_64 2/4 Verifying : mysql-community-client-5.7.25-1.el7.x86_64 3/4 Verifying : mysql-community-server-5.7.25-1.el7.x86_64 4/4 Installed: mysql-community-server.x86_64 0:5.7.25-1.el7 Dependency Installed: mysql-community-client.x86_64 0:5.7.25-1.el7 mysql-community-common.x86_64 0:5.7.25-1.el7 mysql-community-libs.x86_64 0:5.7.25-1.el7 Complete! [root@gogs ~]# |
「Complete!」と表示されれば完了です。
バージョン確認
「mysql –version」コマンドで確認します。
1 2 3 |
[root@gogs ~]# mysql --version mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper [root@gogs ~]# |