LoginSignup
0
1

More than 5 years have passed since last update.

MySQL 5.6 から MariaDB 10.3 への移行を試してみる

Last updated at Posted at 2018-07-11

MySQL 5.6 のインストール

SELinux 無効化

/etc/sysconfig/selinux
SELINUX=disable
SELINUXTYPE=targeted

firewalld の削除

yum -y remove firewalld

MySQL 5.6 / PHP等のインストール

yum -y install wget yum-utils php php-mysql httpd
yum localinstall http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
yum -y install mysql-community-server

MySQL 起動

service mysqld stop

WordPress のインストール

WordPress用データベースの作成

mysql> create database wordpress;

WordPressのダウンロード, 展開, Apacheの起動

cd /var/www/html/
wget https://wordpress.org/latest.tar.gz
tar xvf latest.tar.gz
mv wordpress wp
systemctl enable httpd
systemctl start httpd

http://ip_address_server/wp/ で初期設定ウィザードから初期設定を行います。

投稿を行った状態

image.png

MySQL 5.6 のデータをバックアップ

mysqldump ですべてのデータをバックアップします。

mysqldump --all-databases > dump.sql

MySQL 5.6 の datadir は念のため、バックアップしておきます。

service mysqld stop
cd /var/lib
mv mysql mysql5.6

MariaDB 10.3 のインストール

MySQL関連のRPMを削除します。

yum -y remove "mysql*"

MariaDB Package Repository Setup and Usage に記述されている、以下のコマンドを実行し、/etc/yum.repos.d/ に mariadb.repo を作成します。

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

MariaDB 10.3 をインストールします。

yum -y install MariaDB-server
systemctl enable mariadb
systemctl start mariadb

さきほど mysqldump で取得したダンプデータを MariaDB にリストアします。

mysql < dump.sql

ブラウザで WordPress が利用可能か確認すると、MySQL 5.6の時と同様に稼働していることが確認できました。

image.png

MySQL 5.7 では MariaDB 10.x との乖離がかなり大きいですが、MySQL 5.6 からだと mysqldump でダンプしたデータがそのままリストアできました。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1