1、添加mariabd yum源
vi /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/10.5/centos7-amd64/
gpgkey = https://mirrors.tuna.tsinghua.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
2、建立yum源缓存
yum clean all
yum makecache
3、安装
yum install -y mariadb mariadb-server
4、启动
systemctl start mariadb
5、设置开机自启
systemctl enable mariadb
6、修改root密码
mysqladmin -u root -p password root
7、验证