MYSQL5.7から8.0へのバージョンアップ
phpを先日バージョンアップしたのですが、実はその前に、mysqlについてもバージョンアップしました。
久しぶりのサーバの中をいろいろと確認するとそれぞれにバージョンが古いので
このままでは、セキュリティ上もよくないと思いまず新年一発目でこちらのmysqlをバージョンアップしました。
(記事としては、2発目ですが・・・)
現在のOSのバージョンは、6.10です。
こちらも7に上げないとと思っているのですが踏ん切りがつかず・・・
今回は、mysqlのバージョンアップでいこうと思います。
[root@tkweblife ~]# cat /etc/redhat-release CentOS release 6.10 (Final)
mysqlのバージョンは、5.7です。
どうやらいつのまに8に上がっていたのでこんなにバージョンが上がっていると少し焦って作業に入りました。
[root@tkweblife ~]# mysql --version mysql Ver 14.14 Distrib 5.7.18, for Linux (x86_64) using EditLine wrapper
まずmysqlのバージョンが新しいのは、mysql-community-serverにあるようです。
[root@tkweblife yum.repos.d]# yum info mysql-community-server
読み込んだプラグイン:fastestmirror, priorities, security
Determining fastest mirrors
* base: mirrors.cat.net
* centos-sclo-rh: mirrors.cat.net
* centos-sclo-sclo: mirrors.cat.net
* extras: mirrors.cat.net
* updates: mirrors.cat.net
base | 3.7 kB 00:00
centos-sclo-rh | 2.9 kB 00:00
centos-sclo-sclo | 2.9 kB 00:00
extras | 3.4 kB 00:00
mysql80-community | 2.5 kB 00:00
mysql80-community/primary_db | 98 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db 42% [====== ] 0.0 B/s | 3.4 MB --:-- ETA
updates/primary_db 84% [============- ] 5.6 MB/s | 6.8 MB 00:00 ETA
updates/primary_db | 8.0 MB 00:00
12 packages excluded due to repository priority protections
インストール済みパッケージ
名前 : mysql-community-server
アーキテクチャ : x86_64
バージョン : 5.7.18
リリース : 1.el6
容量 : 769 M
リポジトリー : installed
提供元リポジトリー : mysql57-community
要約 : A very fast and reliable SQL database server
URL : http://www.mysql.com/
ライセンス : Copyright (c) 2000, 2017, Oracle and/or its affiliates.
: All rights reserved. Under GPLv2 license as shown in the
: Description field.
説明 : 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.
利用可能なパッケージ
名前 : mysql-community-server
アーキテクチャ : x86_64
バージョン : 8.0.19
リリース : 1.el6
容量 : 520 M
リポジトリー : mysql80-community
要約 : A very fast and reliable SQL database server
URL : http://www.mysql.com/
ライセンス : Copyright (c) 2000, 2019, Oracle and/or its affiliates.
: All rights reserved. Under GPLv2 license as shown in the
: Description field.
説明 : 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.
リポジトリ mysql80-communityに最新のMysqlサーバがあるようですのであらかじめenableでインストール可能の設定にしておきます。
mysql-community.repoを編集します。
vi mysql-community.repo
"mysql-community.repo" 58L, 1625C[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
# 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/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/
enabled=1 <---- ここのenable=1にしてインストール可能にする
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-preview]
name=MySQL Tools Preview
baseurl=http://repo.mysql.com/yum/mysql-tools-preview/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-cluster-7.5-community]
name=MySQL Cluster 7.5 Community
baseurl=http://repo.mysql.com/yum/mysql-cluster-7.5-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
gpgcheck=1
enabled=0
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/name=MySQL 5.7 Community Server
[mysql57-community]
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
gpgcheck=1
enabled=0
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/name=MySQL 5.6 Community Server
上記を編集すると有効化されます。
[root@tkweblife yum.repos.d]# yum repolist all | grep mysql mysql-cluster-7.5-community MySQL Cluster 7.5 Community 無効 mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - 無効 mysql-connectors-community MySQL Connectors Community 無効 mysql-connectors-community-source MySQL Connectors Community - S 無効 mysql-tools-community MySQL Tools Community 無効 mysql-tools-community-source MySQL Tools Community - Source 無効 mysql-tools-preview MySQL Tools Preview 無効 mysql-tools-preview-source MySQL Tools Preview - Source 無効 mysql55-community MySQL 5.5 Community Server 無効 mysql55-community-source MySQL 5.5 Community Server - S 無効 mysql56-community MySQL 5.6 Community Server 無効 mysql56-community-source MySQL 5.6 Community Server - S 無効 mysql57-community MySQL 5.7 Community Server 無効 mysql57-community-source MySQL 5.7 Community Server - S 無効 mysql80-community MySQL 8.0 Community Server 有効: 141 mysql80-community-source MySQL 8.0 Community Server - S 無効
これでmysql80-community 有効化されているのでバージョンを8にします。
[root@tkweblife yum.repos.d]# yum -disable mysql56-community install mysql-communnity-server
・
省略
・
================================================================================
パッケージ アーキテクチャ
バージョン リポジトリー 容量
================================================================================
更新:
mysql-community-server x86_64 8.0.19-1.el6 mysql80-community 520 M
依存性関連での更新をします。:
mysql-community-client x86_64 8.0.19-1.el6 mysql80-community 47 M
mysql-community-common x86_64 8.0.19-1.el6 mysql80-community 727 k
mysql-community-devel x86_64 8.0.19-1.el6 mysql80-community 7.8 M
mysql-community-libs x86_64 8.0.19-1.el6 mysql80-community 4.6 M
トランザクションの要約
================================================================================
アップグレード 5 パッケージ
総ダウンロード容量: 580 M
これでいいですか? [y/N]y
パッケージをダウンロードしています:
・
省略
・
整理中 : mysql-community-devel-5.7.18-1.el6.x86_64 6/10
整理中 : mysql-community-server-5.7.18-1.el6.x86_64 7/10
整理中 : mysql-community-client-5.7.18-1.el6.x86_64 8/10
整理中 : mysql-community-libs-5.7.18-1.el6.x86_64 9/10
整理中 : mysql-community-common-5.7.18-1.el6.x86_64 10/10
Verifying : mysql-community-client-8.0.19-1.el6.x86_64 1/10
Verifying : mysql-community-devel-8.0.19-1.el6.x86_64 2/10
Verifying : mysql-community-common-8.0.19-1.el6.x86_64 3/10
Verifying : mysql-community-libs-8.0.19-1.el6.x86_64 4/10
Verifying : mysql-community-server-8.0.19-1.el6.x86_64 5/10
Verifying : mysql-community-server-5.7.18-1.el6.x86_64 6/10
Verifying : mysql-community-libs-5.7.18-1.el6.x86_64 7/10
Verifying : mysql-community-common-5.7.18-1.el6.x86_64 8/10
Verifying : mysql-community-devel-5.7.18-1.el6.x86_64 9/10
Verifying : mysql-community-client-5.7.18-1.el6.x86_64 10/10
更新:
mysql-community-server.x86_64 0:8.0.19-1.el6
依存性を更新しました:
mysql-community-client.x86_64 0:8.0.19-1.el6
mysql-community-common.x86_64 0:8.0.19-1.el6
mysql-community-devel.x86_64 0:8.0.19-1.el6
mysql-community-libs.x86_64 0:8.0.19-1.el6
完了しました!
これでmysqlのバージョンが8.0になりました。-disable mysql56-communityは、なぜか5.6のバージョンもインストールしようとするので明示的に5.6のリポジトリは、インストールしないようにしてます。
このあとは、サーバを再起動します。
[root@tkweblife yum.repos.d]# /etc/init.d/mysqld stop mysqld を停止中: [ OK ] [root@tkweblife yum.repos.d]# /etc/init.d/mysqld start MySQL Daemon failed to start. mysqld を起動中: [失敗]
失敗です。
mysqlの設定ファイルもバージョンアップにより変更しないといけないところがあるようです。
query_cache_で始まる項目は、コメントアウト
また、認証方式もバージョンアップで変更されてしまうので以前使用している方法で実施するため
追記します。
[root@tkweblife etc]# vi my.cnf ・・・ 省略 default_authentication_plugin= mysql_native_password #query_cache_size=8M #query_cache_limit=1M #query_cache_min_res_unit=4k #テーブル定義のみキャッシュする 1400--->400 20170627 #table_definition_cache=400
上記query_cacheで始まる項目は、コメントアウトする
[mysqld]の行に
default_authentication_plugin= mysql_native_passwordを追記する。
以上を書き込んで起動すると異状なく起動しました。
これでバージョンアップ完了です。
[root@tkweblife ~]# mysql --version mysql Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)
応援をお願いします(^^;
*****************************************************************************








