在CentOS 7上安装MariaDB 10.0(使用SCL)

首先

使用软件收集(SCL)在CentOS7上安装MariaDB10.0。
原文链接:MySQL、MariaDB的各种安装方法和EOL总结 – Qiita
参考链接:快速入门 — 软件收集

支援

若采用此方法进行引入,则据《Red Hat Software Collections Product Life Cycle – Red Hat Customer Portal》显示,2018年4月被视为EOL(即到期)。
之后可能不会对报告的漏洞或问题进行修复。

日志。

仓库注册

# yum install -y centos-release-scl

安装

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

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

启动/停止MySQL

# systemctl start rh-mariadb100-mariadb
# systemctl status rh-mariadb100-mariadb
● rh-mariadb100-mariadb.service - MariaDB 10.0 database server
   Loaded: loaded (/usr/lib/systemd/system/rh-mariadb100-mariadb.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-10-21 15:14:36 UTC; 10s ago
  Process: 555 ExecStartPost=/usr/bin/scl enable $RH_MARIADB100_SCLS_ENABLED -- /opt/rh/rh-mariadb100/root/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 403 ExecStartPost=/usr/bin/scl enable $RH_MARIADB100_SCLS_ENABLED -- /opt/rh/rh-mariadb100/root/usr/libexec/mysql-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 280 ExecStartPre=/usr/bin/scl enable $RH_MARIADB100_SCLS_ENABLED -- /opt/rh/rh-mariadb100/root/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
  Process: 254 ExecStartPre=/usr/bin/scl enable $RH_MARIADB100_SCLS_ENABLED -- /opt/rh/rh-mariadb100/root/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
  Process: 248 ExecStartPre=/usr/bin/scl enable $RH_MARIADB100_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mariadb100 (code=exited, status=0/SUCCESS)
 Main PID: 402 (mysqld_safe)
   CGroup: /docker/f306e169a685c3f0ac252af7a0bbf377f3f7adf1bd16391e08d94bbea8fdb6bf/system.slice/rh-mariadb100-mariadb.service
           tq402 /bin/sh /opt/rh/rh-mariadb100/root/usr/bin/mysqld_safe --basedir=/opt/rh/rh-mariadb100/roo...
           mq525 /opt/rh/rh-mariadb100/root/usr/libexec/mysqld --basedir=/opt/rh/rh-mariadb100/root/usr --d...
           ? 402 /bin/sh /opt/rh/rh-mariadb100/root/usr/bin/mysqld_safe --basedir=/opt/rh/rh-mariadb100/roo...

Oct 21 15:14:17 f306e169a685 systemd[1]: Starting MariaDB 10.0 database server...
Oct 21 15:14:21 f306e169a685 scl[280]: Initializing MariaDB database
Oct 21 15:14:21 f306e169a685 scl[280]: 191021 15:14:21 [Note] /opt/rh/rh-mariadb100/root/usr/libexec/m...8 ...
Oct 21 15:14:30 f306e169a685 scl[280]: 191021 15:14:30 [Note] /opt/rh/rh-mariadb100/root/usr/libexec/m...6 ...
Oct 21 15:14:33 f306e169a685 mysqld_safe-scl-helper[402]: 191021 15:14:33 mysqld_safe Logging to '/var/o...g'.
Oct 21 15:14:33 f306e169a685 mysqld_safe-scl-helper[402]: 191021 15:14:33 mysqld_safe Starting mysqld da...sql
Oct 21 15:14:36 f306e169a685 systemd[1]: Started MariaDB 10.0 database server.
Hint: Some lines were ellipsized, use -l to show in full.
# systemctl stop rh-mariadb100-mariadb
# systemctl status rh-mariadb100-mariadb
● rh-mariadb100-mariadb.service - MariaDB 10.0 database server
   Loaded: loaded (/usr/lib/systemd/system/rh-mariadb100-mariadb.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Oct 21 15:14:17 f306e169a685 systemd[1]: Starting MariaDB 10.0 database server...
Oct 21 15:14:21 f306e169a685 scl[280]: Initializing MariaDB database
Oct 21 15:14:21 f306e169a685 scl[280]: 191021 15:14:21 [Note] /opt/rh/rh-mariadb100/root/usr/libexec/m...8 ...
Oct 21 15:14:30 f306e169a685 scl[280]: 191021 15:14:30 [Note] /opt/rh/rh-mariadb100/root/usr/libexec/m...6 ...
Oct 21 15:14:33 f306e169a685 mysqld_safe-scl-helper[402]: 191021 15:14:33 mysqld_safe Logging to '/var/o...g'.
Oct 21 15:14:33 f306e169a685 mysqld_safe-scl-helper[402]: 191021 15:14:33 mysqld_safe Starting mysqld da...sql
Oct 21 15:14:36 f306e169a685 systemd[1]: Started MariaDB 10.0 database server.
Oct 21 15:15:06 f306e169a685 systemd[1]: Stopping MariaDB 10.0 database server...
Oct 21 15:15:07 f306e169a685 systemd[1]: Stopped MariaDB 10.0 database server.
Hint: Some lines were ellipsized, use -l to show in full.

设置/取消MySQL自动启动配置

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

各种确认 (Gè

# systemctl start rh-mariadb100-mariadb
# mysql -u root -e 'select version();'
+-----------------+
| version()       |
+-----------------+
| 10.0.33-MariaDB |
+-----------------+
广告
将在 10 秒后关闭
bannerAds