米饭粑 米饭粑
  • 首页
  • 好物推荐
    • 干货分享
    • 好物推荐
    • 免费资源
    • 非专业测评
  • 技术架构
    • Linux
    • HTTPS
    • Windows Server
  • 关于米饭
  • 教程&更多
    • 更多教程
    • 资讯新闻
    • 琐琐碎碎
    • 打赏米饭
    • 阿里云Ping
  • 友情链接
首页 › 技术架构 › 数据库 › RHEL8 CentOS8 安装 MariaDB 10.3 10.4 教程

RHEL8 CentOS8 安装 MariaDB 10.3 10.4 教程

妙正灰
3年前数据库阅读 1,323

介绍

RHEL 8 默认包含 MySQL 和 MariaDB,上一篇《RHEL8 CentOS8 下安装 MySQL 8.0》 介绍了如何安装 MysQL 8.0,本篇则介绍如何安装 MariaDB

MariaDB 10.3 介绍

MariaDB 10.3 是 MariaDB 10.2 的演进版,带来了几个全新功能,InnoDB 继续兼容 MySQL 5.7。

MariaDB 10.3 比较大的更新就是两大全新引擎 MyRocks 和 Spider 都进入稳定生产阶段了,MyRocks 有着非常优异的特性:更高的压缩效率、更快的写入效率、更快加载数据和更快的复制性能。Spider存储引擎是具有内置分片功能的存储引擎,它支持分区和xa事务,可以像处理同一个实例上的表一样处理不同MariaDB实例的表。 当然还有引入AliSQL 的新特性。

MariaDB 10.4 介绍

MariaDB 10.4 基于 MariaDB 10.3 进行修改和增强,带来了几个全新功能,InnoDB 则继续兼容 MySQL 5.7 而不是 8.0。 预计兼容 MySQL 8.0 的版本将是 MariaDB 10.5。

MairaDB 带来了如下特性:

  1. 安全增强,自动检测攻击行为以及加密增强能力。
  2. 更强劲的 Oracle 兼容型,去 O 数据库将不仅仅是 PostgreSQL
  3. InnoDB、Spider和MyRocks 存储引擎的补丁修复
  4. 引入分布式存储引擎
  5. 数据库性能的增强优化

安装

目前 RHEL8 和 CentOS8 引用新的软件源方式——APPStream,针对非系统核心的软件可以让其保持支持主流版本的能力,以及满足部分客户同一个软件想同时安装不同版本的需求。后续预计 RHEL 和 CentOS 8 会在 MariaDB 10.5 稳定版发布后提供受到官方支持的软件源。

RHEL 系统的 APPStream 的稳定性肯定是最高的,也会最贴合系统,APPStream 的,目的是为了保持软件版本跟上主流支持,并让系统同时支持安装多个版本。

MariaDB 社区源则可以体验到最新的 MariaDB 版本,不过毕竟是社区版本,其中好坏也是仁者见仁智者见智的了

安装虚拟内存:(可选)如果主机内存小于1G需要设置 SWAP,不然无法启动 MySQL。 MySQL 8.0 的 InnoDB 很吃内存。

curl -o create-swap.sh https://gist.githubusercontent.com/ivmm/1ecb35c74caef54727cdd9798dfb72bd/raw/5e697441ba6784f04d674556462478e0e64a317a/create-swap.sh
sh create-swap.sh 1G // 1G设置1G交换内存,可以自定义

APPStream 安装 10.3

一、安装 MariaDB 10.3

yum install mariadb-server

三、启动 MariaDB 10.3 服务和开启启动

systemctl start mariadb
systemctl enable mariadb

四、安全初始化,设置Root密码和进行安全设置,默认密码为空

mysql_secure_installation

基本介绍:
Enter current password for root (enter for none):
解释:输入当前 root 用户密码,默认为空,直接回车。
Set root password? [Y/n] y > > 解释:要设置 root 密码吗?输入 y 表示愿意。
Remove anonymous users? [Y/n] y
解释:要移除掉匿名用户吗?输入 y 表示愿意。
Disallow root login remotely? [Y/n] y
解释:不想让 root 远程登陆吗?输入 y 表示愿意。
Remove test database and access to it? [Y/n] y
解释:要去掉 test 数据库吗?输入 y 表示愿意。
Reload privilege tables now? [Y/n] y
解释:想要重新加载权限吗?输入 y 表示愿意。

五、 登入数据库查看是否安装成功

mysql -u root -p

然后输入密码后登录

六、简单查个版本号校验一下

mysql> select version();
+-----------------+
| version()       |
+-----------------+
| 10.3.11-MariaDB |
+-----------------+
1 row in set (0.000 sec)

维护命令

systemctl stop mariadb.service
systemctl start mariadb.service
systemctl restart mariadb.service
systemctl status mariadb.service

文件地址

MySQL 位置 路径 备注
my.cnf /etc/my.cnf.d/mysql-server.cnf /etc/my.cnf 是个空文件
目录 /var/lib/mysql
socket /var/lib/mysql/mysql.sock
错误日志 /var/log/mariadb/mariadb.log
PID文件 /run/mariadb/mariadb.pid

MairaDB 社区版安装 10.4

MariaDB 社区版支持 RHEL8、CentOS8、OracleLinux8 安装 10.3 以上的版本,不提供 10.2 及以下的版本的预编译版。

一、 添加软件源

curl -o /etc/yum.repos.d/MariaDB.repo https://gist.githubusercontent.com/ivmm/b04eaa493dd9682ff6d9ddc03d3cdc24/raw/86a8f4315a271396753aa43260362e5735dd866f/MariaDB.repo

二、安装 boost 库

yum install boost-program-options

三、安装 MariaDB 10.4

yum --disablerepo=rhel-8-for-x86_64-appstream-rpms install MariaDB-server MariaDB-client

注释:

--disablerepo=rhel-8-for-x86_64-appstream-rpms 这个参数是为了临时屏蔽默认的 APPStream 源,不然会提示找不到 MariaDB-server。

四、启动 MariaDB 10.3 服务和开启启动

systemctl start mariadb
systemctl enable mariadb

五、安全初始化,设置Root密码和进行安全设置,默认密码为空

mysql_secure_installation

基本介绍:

Switch to unix_socket authentication [Y/n] y
解释:使用 Unix 套接口进行权限校验,输入 y 表示愿意。
Enter current password for root (enter for none):
解释:输入当前 root 用户密码,默认为空,直接回车。
Set root password? [Y/n] y > > 解释:要设置 root 密码吗?输入 y 表示愿意。
Remove anonymous users? [Y/n] y
解释:要移除掉匿名用户吗?输入 y 表示愿意。
Disallow root login remotely? [Y/n] y
解释:不想让 root 远程登陆吗?输入 y 表示愿意。
Remove test database and access to it? [Y/n] y
解释:要去掉 test 数据库吗?输入 y 表示愿意。
Reload privilege tables now? [Y/n] y
解释:想要重新加载权限吗?输入 y 表示愿意。

六、 登入数据库查看是否安装成功

mysql -u root -p

然后输入密码后登录

七、简单查个版本号校验一下

MariaDB [(none)]> select version();
+----------------+
| version()      |
+----------------+
| 10.4.5-MariaDB |
+----------------+
1 row in set (0.000 sec)

维护命令

systemctl stop mariadb.service
systemctl start mariadb.service
systemctl restart mariadb.service
systemctl status mariadb.service

文件地址

MySQL 位置 路径 备注
my.cnf /etc/my.cnf.d/server.cnf /etc/my.cnf 是个空文件
目录 /var/lib/mysql
socket /var/lib/mysql/mysql.sock
CentOS8 MariaDB RHEL8 数据库 虚拟内存
赞(1)
本文系作者 @妙正灰 原创发布在 米饭粑。未经许可,禁止转载。
RHEL8 CentOS8 下安装 MySQL 8.0
上一篇
阿里云ACP每日两题(No.0009)
下一篇
标签
Appnode Brotli CDN CentOS CentOS8 Debian DNS ECC ECS Ghost HTTP2 HTTPS IIS IPV6 Linux LiteSpeed MariaDB MySQL Nginx OLS OpenLiteSpeed OpenResty OSS PageSpeed PHP PHP7 QUIC Redis RHEL RHEL8 SSL TokuDB Ubuntu Windows Server 2016 Wordpress 云服务器 升级 域名 对象存储 微软 数据库 百度 笔记本 阿里云 阿里云ACP
归档
RHEL8 CentOS8 快速开启 TCP BBR 实现高效单边加速
2年前
1,766 2
在 RHEL8/CentOS8 上安装 OpenJDK/Oracle JDK 1.8、11
3年前
1,589 4
在 RHEL8 CentOS8 下构建 LNMP 环境教程
3年前
1,056 6
RHEL8 CentOS8 下安装 MySQL 8.0
3年前
1,447 4
1
  • 1
Copyright © 2011-2022 米饭粑. Designed by nicetheme.
浙ICP备15006212号-1
  • 首页
  • 教程
  • 好物
  • 关于
  • 链接
  • 打赏
# 402 # # 113 # # 546 # # 548 # # 460 #
妙正灰
文科屌丝伪IT男一枚.
337
文章
385
评论
449
喜欢