yum安装MariaDB

yum安装MariaDB

使用MariaDB Repository Configuration Tool生成yum源:

https://downloads.mariadb.org/mariadb/repositories/#mirror=tuna

创建mariadb.repo文件:

cat > /etc/yum.repos.d/mariadb.repo <<EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

替换为中科大源

http://mirrors.ustc.edu.cn/help/mariadb.html

sed -i 's#yum\.mariadb\.org#mirrors.ustc.edu.cn/mariadb/yum#' /etc/yum.repos.d/mariadb.repo

或者替换为阿里云源
https://developer.aliyun.com/mirror/

sed -i 's#yum\.mariadb\.org#mirrors.aliyun.com/mariadb/yum#' /etc/yum.repos.d/mariadb.repo

安装mariadb

yum install -y MariaDB-server MariaDB-client

启动mariadb服务并设为开机启动

systemctl enable --now mariadb

登录到数据库,此时root账户的密码为空,直接回车即可,退出Mariadb执行exit即可。

mysql -uroot -p

MariaDB [(none)]> show databases;

MariaDB安全配置

https://mariadb.com/kb/en/mysql_secure_installation/

mysql_secure_installation

执行过程

#输入root(mysql)的密码。默认没有,直接回车
Enter current password for root (enter for none): 
#是否切换到unix套接字身份验证[Y/n]
Switch to unix_socket authentication [Y/n] n
#是否设置root密码
Change the root password? [Y/n]
#如果选Y,就输入2次密码
New password:
Re-enter new password:
#是否删除匿名用户?(就是空用户),建议删除
Remove anonymous users? [Y/n]
#是否不允许远程root登录
Disallow root login remotely? [Y/n] n
#是否删除test数据库
Remove test database and access to it? [Y/n] n
#是否加载权限使之生效
Reload privilege tables now? [Y/n] y

允许远程登录

mysql -uroot -p123456

GRANT ALL PRIVILEGES  ON *.* TO  'root'@'%'IDENTIFIED  BY  '123456'  WITH  GRANT  OPTION;

验证远程登录

mysql -uroot -p123456 -h 192.168.93.12
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值