第 2 篇 : 安装mariadb-10.3

1. 安装

CentOS-8.4默认安装的是mariadb-10.3

yum install mariadb-server

install确认

y

导入数字签名

y

安装完成

注 :设置 官方镜像源 安装指定版本

先找到自己需要的版本,点击进去,选择 MariaDB Repositories ,选择好即可出现镜像源
内容大致如下

# MariaDB 10.8 CentOS repository list - created 2023-02-07 06:22 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
#  baseurl = https://rpm.mariadb.org/10.8/centos/$releasever/$basearch
baseurl = https://tw1.mirror.blendbyte.net/mariadb/yum/10.8/centos/$releasever/$basearch
# gpgkey= https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey=https://tw1.mirror.blendbyte.net/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

编辑镜像源地址文件,把上面的信息放进去保存好,重新yum即可

vi /etc/yum.repos.d/MariaDB.repo

2. 数据库相关配置

2.1 启动数据库并设定开机启动

systemctl start mariadb
systemctl enable mariadb

在这里插入图片描述

2.2 数据库初始化

mysql_secure_installation 或 mariadb-secure-installation

输入用户root的密码,第一次直接回车

回车

开始社会root用户密码

y

移除匿名用户

y

在这里插入图片描述

n

移除tset库

y

重新加载权限

y

初始化完成

2.3 远程连接数据库

firewall-cmd --zone=public --add-port=3306/tcp --permanent
mysql -u root -p

登录myslq

use mysql;
select host, user from user;

在这里插入图片描述

update user set host='%' where host='localhost.localdomain';
flush privileges;

更新远程用户连接

exit
重新启动虚拟机,并通过Navicat连接

测试连接


版权声明:本文为qiezi__原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。