CentOS 6にMariaDB 10.1をインストール（SCL）

# はじめに

Software Collection(SCL)を利用してCentOS6にMariaDB 10.1をインストール
親記事：[MySQL, MariaDBの各種インストール方法とEOLまとめ \- Qiita](https://qiita.com/witchcraze/items/72291ee035437ec83273)
参考：[Quick Start — Software Collections](https://www.softwarecollections.org/en/docs/)

## サポート

本手法で導入した場合、[Red Hat Software Collections Product Life Cycle - Red Hat Customer Portal](https://access.redhat.com/support/policy/updates/rhscl)より、2019-05がEOLだと思われる。
それ以降に報告された脆弱性や不具合への対応は実施されない可能性がある。

## LOG

### レポジトリ登録

```shell-session
# yum install -y centos-release-scl
```

### インストール

```shell-session
# cat /etc/redhat-release
CentOS release 6.10 (Final)

# yum install -y rh-mariadb101
# scl enable rh-mariadb101 bash
... 略
```

### mysql起動/停止

初回起動時には初期設定関係のメッセージが表示される。

```shell-session
# service rh-mariadb101-mariadb start
Initializing MariaDB database
2019-10-21 14:54:44 139789040650208 [Note] /opt/rh/rh-mariadb101/root/usr/libexec/mysqld (mysqld 10.1.29-MariaDB) starting as process 258 ...
2019-10-21 14:54:48 140434216777696 [Note] /opt/rh/rh-mariadb101/root/usr/libexec/mysqld (mysqld 10.1.29-MariaDB) starting as process 288 ...
2019-10-21 14:54:51 140268612790240 [Note] /opt/rh/rh-mariadb101/root/usr/libexec/mysqld (mysqld 10.1.29-MariaDB) starting as process 318 ...

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:

scl enable rh-mariadb101 -- '/opt/rh/rh-mariadb101/root/usr/bin/mysqladmin' -u root password 'new-password'
scl enable rh-mariadb101 -- '/opt/rh/rh-mariadb101/root/usr/bin/mysqladmin' -u root -h 0f6bc0babe5f password 'new-password'

Alternatively you can run:
scl enable rh-mariadb101 -- '/opt/rh/rh-mariadb101/root/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/

Starting rh-mariadb101-mariadb:                            [  OK  ]

# service rh-mariadb101-mariadb status
rh-mariadb101-mariadb (pid  503) is running...
```

```shell-session
# service rh-mariadb101-mariadb stop
Stopping rh-mariadb101-mariadb:                            [  OK  ]

# service rh-mariadb101-mariadb status
rh-mariadb101-mariadb is stopped
```

### mysql自動起動設定/設定解除

```shell-session
# chkconfig rh-mariadb101-mariadb on
# chkconfig --list rh-mariadb101-mariadb
rh-mariadb101-mariadb   0:off   1:off   2:on    3:on    4:on    5:on    6:off
```

```shell-session
# chkconfig rh-mariadb101-mariadb off
# chkconfig --list rh-mariadb101-mariadb
rh-mariadb101-mariadb   0:off   1:off   2:off   3:off   4:off   5:off   6:off
```

### 各種確認

```shell-session
# service rh-mariadb101-mariadb start
Starting rh-mariadb101-mariadb:                            [  OK  ]

# mysql -u root -e'select version();'
+-----------------+
| version()       |
+-----------------+
| 10.1.29-MariaDB |
+-----------------+
```