MariaDB yum 安装

一、创建MariaDB.repo文件
1.1、CentOS 6.x的源配置
1.2、CentOS 7.x的源配置
1.3、导入GPG key
二、运行安装命令安装MariaDB
三、启动
3.1、CentOS 6.x 启动
3.2、CentOS 7.x 启动
四、登录配置
4.1、执行下面命令进行配置
4.2、开始配置
4.2.1、首先是设置密码,会提示先输入密码
4.2.2、设置密码
4.2.3、其他配置
参考资料
一、创建MariaDB.repo文件
打开MariaDB.repo文件后写入源配置
vim /etc/yum.repos.d/MariaDB.repo
1.1、CentOS 6.x的源配置

[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos6-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

1.2、CentOS 7.x的源配置

[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.1/centos7-amd64/
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

1.3、导入GPG key

rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

二、运行安装命令安装MariaDB

yum makecache
yum -y install MariaDB-server MariaDB-client

三、启动
3.1、CentOS 6.x 启动

service mysql start #启动服务
chkconfig mysql on #加入开机自启动

3.2、CentOS 7.x 启动

systemctl start mariadb.service #启动服务
systemctl enable mariadb.service

#开机自启动 四、登录配置
4.1、执行下面命令进行配置

mysql_secure_installation

4.2、开始配置
4.2.1、首先是设置密码,会提示先输入密码

Enter current password for root (enter for none):<–初次运行直接回车

4.2.2、设置密码

Set root password? [Y/n] <是否设置root用户密码,输入y并回车或直接回车
New password: <设置root用户的密码
Re-enter new password: <再输入一次你设置的密码

4.2.3、其他配置

Remove anonymous users? [Y/n] <是否删除匿名用户,回车  
Disallow root login remotely? [Y/n]    <–是否禁止root远程登录,回车(后面授权配置)
Remove test database and access to it? [Y/n] <是否删除test数据库,回车
Reload privilege tables now? [Y/n] <是否重新加载权限表,回车
posted @ 2020-09-13 18:59  MR__Wang  阅读(477)  评论(0编辑  收藏  举报