Help us understand the problem. What is going on with this article?

CentOS 7にMySQL 5.6をインストール(SCL)

はじめに

Software Collection(SCL)を利用してCentOS7にMySQL5.6をインストール
親記事:MySQL, MariaDBの各種インストール方法とEOLまとめ - Qiita
参考:Quick Start — Software Collections

サポート

本手法で導入した場合、Red Hat Software Collections Product Life Cycle - Red Hat Customer Portalより、2018-04がEOLだと思われる。
それ以降に報告された脆弱性や不具合への対応は実施されない可能性がある。

LOG

レポジトリ登録

# yum install -y centos-release-scl

インストール

# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

# yum install -y rh-mysql56
# scl enable rh-mysql56 bash
... 略

mysql起動/停止

# systemctl start rh-mysql56-mysqld
# systemctl status rh-mysql56-mysqld
● rh-mysql56-mysqld.service - MySQL 5.6 database server
   Loaded: loaded (/usr/lib/systemd/system/rh-mysql56-mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-10-21 14:34:30 UTC; 2s ago
  Process: 580 ExecStartPost=/usr/bin/scl enable $RH_MYSQL56_SCLS_ENABLED -- /opt/rh/rh-mysql56/root/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 374 ExecStartPost=/usr/bin/scl enable $RH_MYSQL56_SCLS_ENABLED -- /opt/rh/rh-mysql56/root/usr/libexec/mysql-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 272 ExecStartPre=/usr/bin/scl enable $RH_MYSQL56_SCLS_ENABLED -- /opt/rh/rh-mysql56/root/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
  Process: 246 ExecStartPre=/usr/bin/scl enable $RH_MYSQL56_SCLS_ENABLED -- /opt/rh/rh-mysql56/root/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
  Process: 240 ExecStartPre=/usr/bin/scl enable $RH_MYSQL56_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mysql56 (code=exited, status=0/SUCCESS)
 Main PID: 373 (mysqld_safe)
   CGroup: /docker/6bac11ce5afc7a46c22715a36c911135968027fb1d240ea678b59ac03a34e7fd/system.slice/rh-mysql56-mysqld.service
           tq373 /bin/sh /opt/rh/rh-mysql56/root/usr/bin/mysqld_safe --basedir=/opt/rh/rh-mysql56/root/usr
           mq548 /opt/rh/rh-mysql56/root/usr/libexec/mysqld --basedir=/opt/rh/rh-mysql56/root/usr --datadir...
           ? 373 /bin/sh /opt/rh/rh-mysql56/root/usr/bin/mysqld_safe --basedir=/opt/rh/rh-mysql56/root/usr

Oct 21 14:34:27 6bac11ce5afc scl[272]: Note: new default config file not created.
Oct 21 14:34:27 6bac11ce5afc scl[272]: Please make sure your config file is current
Oct 21 14:34:27 6bac11ce5afc scl[272]: WARNING: Default config file /etc/opt/rh/rh-mysql56/my.cnf exis...ystem
Oct 21 14:34:27 6bac11ce5afc scl[272]: This file will be read by default by the MySQL server
Oct 21 14:34:27 6bac11ce5afc scl[272]: If you do not want to use this, either remove it, or use the
Oct 21 14:34:27 6bac11ce5afc scl[272]: --defaults-file argument to mysqld_safe when starting the server
Oct 21 14:34:27 6bac11ce5afc su[365]: (to mysql) root on none
Oct 21 14:34:28 6bac11ce5afc mysqld_safe-scl-helper[373]: 191021 14:34:28 mysqld_safe Logging to '/var/o...g'.
Oct 21 14:34:28 6bac11ce5afc mysqld_safe-scl-helper[373]: 191021 14:34:28 mysqld_safe Starting mysqld da...sql
Oct 21 14:34:30 6bac11ce5afc systemd[1]: Started MySQL 5.6 database server.
Hint: Some lines were ellipsized, use -l to show in full.
# systemctl stop rh-mysql56-mysqld
# systemctl status rh-mysql56-mysqld
● rh-mysql56-mysqld.service - MySQL 5.6 database server
   Loaded: loaded (/usr/lib/systemd/system/rh-mysql56-mysqld.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Oct 21 14:34:27 6bac11ce5afc scl[272]: WARNING: Default config file /etc/opt/rh/rh-mysql56/my.cnf exis...ystem
Oct 21 14:34:27 6bac11ce5afc scl[272]: This file will be read by default by the MySQL server
Oct 21 14:34:27 6bac11ce5afc scl[272]: If you do not want to use this, either remove it, or use the
Oct 21 14:34:27 6bac11ce5afc scl[272]: --defaults-file argument to mysqld_safe when starting the server
Oct 21 14:34:27 6bac11ce5afc su[365]: (to mysql) root on none
Oct 21 14:34:28 6bac11ce5afc mysqld_safe-scl-helper[373]: 191021 14:34:28 mysqld_safe Logging to '/var/o...g'.
Oct 21 14:34:28 6bac11ce5afc mysqld_safe-scl-helper[373]: 191021 14:34:28 mysqld_safe Starting mysqld da...sql
Oct 21 14:34:30 6bac11ce5afc systemd[1]: Started MySQL 5.6 database server.
Oct 21 14:35:01 6bac11ce5afc systemd[1]: Stopping MySQL 5.6 database server...
Oct 21 14:35:03 6bac11ce5afc systemd[1]: Stopped MySQL 5.6 database server.
Hint: Some lines were ellipsized, use -l to show in full.

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

# systemctl enable rh-mysql56-mysqld
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-mysql56-mysqld.service to /usr/lib/systemd/system/rh-mysql56-mysqld.service.
# systemctl list-unit-files --type=service |grep mysql
rh-mysql56-mysqld.service              enabled
# systemctl disable rh-mysql56-mysqld
Removed symlink /etc/systemd/system/multi-user.target.wants/rh-mysql56-mysqld.service.
# systemctl list-unit-files --type=service |grep mysql
rh-mysql56-mysqld.service              disabled

各種確認

# systemctl start rh-mysql56-mysqld
# mysql -u root -e 'select version();'
+-----------+
| version() |
+-----------+
| 5.6.40    |
+-----------+
witchcraze
個人用wiki代わりのメモを淡々と...
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした