在CentOS 7上安装MariaDB 10.5(通过SCL)
首先
使用软件集合(Software Collection,SCL)在CentOS7上安装MariaDB10.5
参考文章:MySQL、MariaDB的各种安装方法和EOL总结 – Qiita
参考资料:快速入门 — 软件集合
支援
如果使用本方法进行导入,根据Red Hat客户门户网站上的Red Hat Software Collections产品生命周期,可以认为2024-06是EOL(终止生命周期)。
之后可能不会对报告的漏洞和问题进行处理。
记录
注册代码库
# yum install -y centos-release-scl
安装
# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
# yum install -y rh-mariadb105
# scl enable rh-mariadb105 bash
... 略
启动/停止MySQL
# systemctl start rh-mariadb105-mariadb
# systemctl status rh-mariadb105-mariadb
● rh-mariadb105-mariadb.service - MariaDB 10.5 database server
Loaded: loaded (/usr/lib/systemd/system/rh-mariadb105-mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2021-07-12 09:59:46 UTC; 3s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 365 ExecStartPost=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 262 ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Process: 234 ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /opt/rh/rh-mariadb105/root/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Process: 228 ExecStartPre=/usr/bin/scl enable $RH_MARIADB105_SCLS_ENABLED -- /usr/bin/scl_enabled rh-mariadb105 (code=exited, status=0/SUCCESS)
Main PID: 350 (mysqld)
Status: "Taking your SQL requests now..."
CGroup: /docker/b24aceb83e8cfaa30e47f6dce1531963bb58c79c89f644331f451efee07e2fcc/system.slice/rh-mariadb105-mariadb.service
mq350 /opt/rh/rh-mariadb105/root/usr/libexec/mysqld --basedir=/opt/rh/rh-mariadb105/root/usr
? 350 /opt/rh/rh-mariadb105/root/usr/libexec/mysqld --basedir=/opt/rh/rh-mariadb105/root/usr
Jul 12 09:59:42 b24aceb83e8c systemd[1]: Starting MariaDB 10.5 database server...
Jul 12 09:59:42 b24aceb83e8c scl[262]: Initializing MariaDB database
Jul 12 09:59:46 b24aceb83e8c scl[262]: Two all-privilege accounts were created.
Jul 12 09:59:46 b24aceb83e8c mysqld-scl-helper[350]: 2021-07-12 9:59:46 0 [Note] /opt/rh/rh-mariadb105/......
Jul 12 09:59:46 b24aceb83e8c systemd[1]: Started MariaDB 10.5 database server.
Hint: Some lines were ellipsized, use -l to show in full.
# systemctl stop rh-mariadb105-mariadb
# systemctl status rh-mariadb105-mariadb
● rh-mariadb105-mariadb.service - MariaDB 10.5 database server
Loaded: loaded (/usr/lib/systemd/system/rh-mariadb105-mariadb.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Jul 12 09:59:42 b24aceb83e8c systemd[1]: Starting MariaDB 10.5 database server...
Jul 12 09:59:42 b24aceb83e8c scl[262]: Initializing MariaDB database
Jul 12 09:59:46 b24aceb83e8c scl[262]: Two all-privilege accounts were created.
Jul 12 09:59:46 b24aceb83e8c mysqld-scl-helper[350]: 2021-07-12 9:59:46 0 [Note] /opt/rh/rh-mariadb105/......
Jul 12 09:59:46 b24aceb83e8c systemd[1]: Started MariaDB 10.5 database server.
Jul 12 10:00:25 b24aceb83e8c systemd[1]: Stopping MariaDB 10.5 database server...
Jul 12 10:00:25 b24aceb83e8c systemd[1]: Stopped MariaDB 10.5 database server.
Hint: Some lines were ellipsized, use -l to show in full.
MySQL 自启动配置/取消配置
# systemctl enable rh-mariadb105-mariadb
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/rh-mariadb105-mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/rh-mariadb105-mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-mariadb105-mariadb.service to /usr/lib/systemd/system/rh-mariadb105-mariadb.service.
# systemctl list-unit-files --type=service |grep maria
rh-mariadb105-mariadb.service enabled
rh-mariadb105-mariadb@.service disabled
# systemctl disable rh-mariadb105-mariadb
Removed symlink /etc/systemd/system/multi-user.target.wants/rh-mariadb105-mariadb.service.
Removed symlink /etc/systemd/system/mysqld.service.
Removed symlink /etc/systemd/system/mysql.service.
# systemctl list-unit-files --type=service |grep maria
rh-mariadb105-mariadb.service disabled
rh-mariadb105-mariadb@.service disabled
各種核实 (Gè
# systemctl start rh-mariadb105-mariadb
# mysql -u root -e 'select version();'
+----------------+
| version() |
+----------------+
| 10.5.9-MariaDB |
+----------------+