1.增加MariaDB的repo源:

# MariaDB 10.3 CentOS repository list - created 2018-05-26 07:55 UTC  
# http://downloads.mariadb.org/mariadb/repositories/  
[mariadb]  
name = MariaDB  
baseurl = http://yum.mariadb.org/10.3/centos7-amd64  
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB  
gpgcheck=1

2.清除Yum缓存,重建缓存

yum clean all 
yum makecache

3.查询MariaDB源中的软件包

yum list --disablerepo=\* --enablerepo=mariadb

其中test为测试工具,backup为备份工具

4.安装安装MariaDB数据库

yum install MariaDB-client MariaDB-server MariaDB-devel -y

5.启动数据库及设置MariaDB开机自启

systemctl start mariadb  
systemctl enable mariadb

6.初始化数据库,并删除测试数据库及更改权限和设置密码

mysql_secure_installation

第一步为输入密码,首次安装未设定默认为空,直接Enter

Change the root password? [Y/n] 该项为询问是否设置新密码。建议设置新密码。其他项目按照默认Y即可。

7.测试进入MariaDB

 mysql -uroot -p -A  
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2894
Server version: 10.3.7-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

 

留下评论

电子邮件地址不会被公开。 必填项已用*标注