LoginSignup
0
1

More than 3 years have passed since last update.

MariaDB 10.1 から 10.3 へのアップグレード (Debian 9)

Last updated at Posted at 2019-03-08

0. データベースと設定をバックアップ

$ mysqldump -u root -p --all-databases > ~/backup.sql
$ cp -r /etc/mysql ~/

インスタンスのスナップショットを取っておくとなお安心。

1. リポジトリを追加する

https://downloads.mariadb.org/mariadb/repositories/
にアクセスし、自分が欲しいバージョンを選択。

Here are the commands to run to add MariaDB to your system: の下のコマンドを実行する。
(その次のブロックはまだ)

2. 既存のMariaDBを停止する

ついでにWebサーバーも停止1

$ sudo service mysql stop
$ sudo service apache2 stop

3. リポジトリのアップグレード

古いバージョンのアンインストールは必要ない。

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install mariadb-server

apt-get upgrade はGCEだとpython3-google-compute-engineみたいなパッケージ2で失敗するのでやらなくても良いかも。

設定周り

上書きの必要がある場合は都度聞いてくれるので、適宜diffを見て判断。

あまりカスタマイズしていなかったので、基本は上書きで良かったが、GCEの場合はNTPの設定だけ手動で書き直す手間があった。
一旦新しい設定ファイルで上書きした後、poolを使うようになった部分をコメントアウトして以下に書き換える。

/etc/ntp.conf
server metadata.google.internal iburst

参考→https://cloud.google.com/compute/docs/instances/managing-instances?hl=ja

sshdの設定はポート番号など変えていると上書きで入れなくなる可能性があるので注意。

あと何かインストールしろと言われたら入れる。

4. プラグイン設定

バージョンを確認しようとしたら Plugin 'unix_socket' is not loaded とか言われるようになるので対応。

/etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld]
plugin-load-add = auth_socket.so

参考→https://websiteforstudents.com/fix-mariadb-plugin-unix_socket-is-not-loaded-error-on-ubuntu-17-04-17-10/

5. 確認

$ sudo service mysql start
$ sudo service apache2 start
$ sudo mysql -v
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 46
Server version: 10.3.13-MariaDB-1:10.3.13+maria~stretch mariadb.org binary distribution

6. 掃除

$ sudo apt-get autoremove
$ sudo apt-get clean
$ sudo apt-get autoclean

  1. よわよわスペックのインスタンスだとインストールでCPU使用率200%とかになってしまうので負荷になりそうなものは落とすが吉。そもそもDB無いと接続しても何も見れないサイトなので。 

  2. 自分で入れたやつではなくて元々入ってるやつの様な気がしていて手を出すに出せない。 

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