0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RedHat Enterprise Linux 7でRHSCL MariaDB 10.3を使う

Posted at

概要

RHEL7でRedHat Software Collections (RHSCL)を使ってMariaDB 10.3をインストールする。今回はMariaDB 5.5と同居させる。

インストール手順

# yum install rh-mariadb103 rh-mariadb103-mariadb-server rh-mariadb103-mariadb-backup 

下記サイトを参考に、MariaDB 5.6以降でのopen_files_limit, table_open_cacheの値に対応するようにする。
https://www.denet.ad.jp/technology/2017/10/centos7mysql56.html

# mkdir /etc/systemd/system/rh-mariadb103-mariadb.service.d
# vi /etc/systemd/system/rh-mariadb103-mariadb.service.d/limits.conf
[Service]
LimitNOFILE=10000

# systemctl daemon-reload

そのままMariaDB 10.3を起動すると、Listenしているポート番号やUnixソケットが衝突するため、設定を変える。

/etc/opt/rh/rh-mariadb103/my.cnf.d/mariadb-server.cnf
    [mysqld]
+   port = 3307
-   socket=/var/lib/mysql/mysql.sock
+   socket=/var/opt/rh/rh-mariadb103/lib/mysql/mysql.sock

MariaDB 10.3のサービスを起動。

# systemctl start rh-mariadb103-mariadb
# systemctl enable rh-mariadb103-mariadb

動作確認。
ここで、-h 127.0.0.1オプションなどが無いと、mysql.cnfの設定を見てUnixソケットに接続しに行こうとするため、MariaDB 5.5に接続される(ポート指定は無視される)。

# /opt/rh/rh-mariadb103/root/bin/mysql --version
/opt/rh/rh-mariadb103/root/bin/mysql  Ver 15.1 Distrib 10.3.13-MariaDB, for Linux (x86_64) using  EditLine wrapper

# /opt/rh/rh-mariadb103/root/bin/mysql -u root -h 127.0.0.1 -P 3307
または
# /opt/rh/rh-mariadb103/root/bin/mysql -u root -S /var/opt/rh/rh-mariadb103/lib/mysql/mysql.sock

備考

複数バージョンのMariaDBを共存させない場合

他にMariaDBがインストールされていない場合は、syspathsをインストールすることで通常のMariaDBのように扱える。他のMariaDBがインストールされている場合はyumの依存関係チェックでエラーとなる。

  • rh-mariadb103-mariadb-syspaths
  • rh-mariadb103-mariadb-config-syspaths
  • rh-mariadb103-mariadb-server-syspaths

設定ファイルなど

設定ファイル
/etc/opt/rh/rh-mariadb103/my.cnf
/etc/opt/rh/rh-mariadb103/my.cnf.d/

データディレクトリ
/var/opt/rh/rh-mariadb103/lib/mysql

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?