CentOS7 MariaDB インストールメモ

# インストール

本家の手順 (https://mariadb.com/kb/en/library/mariadb-package-repository-setup-and-usage/) でインストールする。

## リポジトリの追加

リポジトリの追加前はこんなだったのが

```bash
$ yum list | grep mariadb
mariadb-libs.x86_64                         1:5.5.60-1.el7_5           @updates
mariadb.x86_64                              1:5.5.60-1.el7_5           updates
mariadb-bench.x86_64                        1:5.5.60-1.el7_5           updates
mariadb-devel.i686                          1:5.5.60-1.el7_5           updates
mariadb-devel.x86_64                        1:5.5.60-1.el7_5           updates
mariadb-embedded.i686                       1:5.5.60-1.el7_5           updates
mariadb-embedded.x86_64                     1:5.5.60-1.el7_5           updates
mariadb-embedded-devel.i686                 1:5.5.60-1.el7_5           updates
mariadb-embedded-devel.x86_64               1:5.5.60-1.el7_5           updates
mariadb-libs.i686                           1:5.5.60-1.el7_5           updates
mariadb-server.x86_64                       1:5.5.60-1.el7_5           updates
mariadb-test.x86_64                         1:5.5.60-1.el7_5           updates
```

リポジトリを追加することで

```bash
$ curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
[sudo] user のパスワード:
[info] Repository file successfully written to /etc/yum.repos.d/mariadb.repo.
[info] Adding trusted package signing keys...
[info] Succeessfully added trusted package signing keys.
```

こうなる。

```bash
$ yum list | grep mariadb
mariadb-libs.x86_64                         1:5.5.60-1.el7_5           @updates
MariaDB-aws-key-management.x86_64           10.3.9-1.el7.centos        mariadb-main
MariaDB-backup.x86_64                       10.3.9-1.el7.centos        mariadb-main
MariaDB-cassandra-engine.x86_64             10.3.9-1.el7.centos        mariadb-main
MariaDB-client.x86_64                       10.3.9-1.el7.centos        mariadb-main
MariaDB-common.x86_64                       10.3.9-1.el7.centos        mariadb-main
MariaDB-compat.x86_64                       10.3.9-1.el7.centos        mariadb-main
MariaDB-connect-engine.x86_64               10.3.9-1.el7.centos        mariadb-main
MariaDB-cracklib-password-check.x86_64      10.3.9-1.el7.centos        mariadb-main
MariaDB-devel.x86_64                        10.3.9-1.el7.centos        mariadb-main
MariaDB-gssapi-server.x86_64                10.3.9-1.el7.centos        mariadb-main
MariaDB-oqgraph-engine.x86_64               10.3.9-1.el7.centos        mariadb-main
MariaDB-rocksdb-engine.x86_64               10.3.9-1.el7.centos        mariadb-main
MariaDB-server.x86_64                       10.3.9-1.el7.centos        mariadb-main
MariaDB-shared.x86_64                       10.3.9-1.el7.centos        mariadb-main
MariaDB-test.x86_64                         10.3.9-1.el7.centos        mariadb-main
MariaDB-tokudb-engine.x86_64                10.3.9-1.el7.centos        mariadb-main
galera.x86_64                               25.3.23-1.rhel7.el7.centos mariadb-main
jemalloc.x86_64                             3.6.0-1.el7                mariadb-main
jemalloc-devel.x86_64                       3.6.0-1.el7                mariadb-main
libzstd.x86_64                              1.3.4-1.el7                mariadb-main
mariadb.x86_64                              1:5.5.60-1.el7_5           updates
mariadb-bench.x86_64                        1:5.5.60-1.el7_5           updates
mariadb-devel.i686                          1:5.5.60-1.el7_5           updates
mariadb-devel.x86_64                        1:5.5.60-1.el7_5           updates
mariadb-embedded.i686                       1:5.5.60-1.el7_5           updates
mariadb-embedded.x86_64                     1:5.5.60-1.el7_5           updates
mariadb-embedded-devel.i686                 1:5.5.60-1.el7_5           updates
mariadb-embedded-devel.x86_64               1:5.5.60-1.el7_5           updates
mariadb-libs.i686                           1:5.5.60-1.el7_5           updates
mariadb-server.x86_64                       1:5.5.60-1.el7_5           updates
mariadb-test.x86_64                         1:5.5.60-1.el7_5           updates
maxscale.x86_64                             2.2.13-1                   mariadb-maxscale
maxscale-cdc-connector.x86_64               2.2.13-1                   mariadb-maxscale
maxscale-devel.x86_64                       2.2.13-1                   mariadb-maxscale
maxscale-experimental.x86_64                2.2.13-1                   mariadb-maxscale
percona-xtrabackup.x86_64                   2.3.10-1.el7               mariadb-tools
percona-xtrabackup-24.x86_64                2.4.12-1.el7               mariadb-tools
qpress.x86_64                               11-1.el7                   mariadb-tools
```

## yum でインストール

```bash
$ sudo yum install MariaDB-server
```

簡単。 依存関係で MariaDB-Client もインストールされるよう。

# 起動

```bash
$ sudo systemctl start mariadb
```

次回 OS 起動時に自動起動させる。

```bash
$ sudo systemctl enable mariadb
```
# firewall の設定

firewall に拒否されていたので，設定変更。

```bash
$ sudo firewall-cmd --permanent --add-service=mysql
$ sudo systemctl restart firewalld
```