yum 命令安装

  1. yum -y install mariadb mariadb-server

启动

  1. systemctl start mariadb

设置开机启动

  1. systemctl enable mariadb

配置

  1. mysql_secure_installation
  1. Enter current password for root (enter for none): #初次运行直接回车
  2. OK, successfully used password, moving on...
  3. Setting the root password ensures that nobody can log into the MariaDB
  4. root user without the proper authorisation.
  5. Set root password? [Y/n] y #设置密码
  6. New password: #输入新密码
  7. Re-enter new password: #确认密码
  8. Password updated successfully!
  9. Reloading privilege tables..
  10. ... Success!
  11. Remove anonymous users? [Y/n] n #是否删除匿名用户
  12. ... skipping.
  13. Disallow root login remotely? [Y/n] y #是否禁止root远程登录
  14. ... Success!
  15. Remove test database and access to it? [Y/n] n #是否删除test数据库
  16. ... skipping.
  17. Reload privilege tables now? [Y/n] y #是否重新加载权限表
  18. ... Success!

开放端口

  1. #查看开放的所有端口
  2. firewall-cmd --list-all
  3. #开放3306端口
  4. firewall-cmd --add-port=3306/tcp

修改存储路径