添加源
vi /etc/yum.repos.d/MariaDB.repo [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
安装
yum install MariaDB-server
防火墙设置
firewall-cmd --zone=public --permanent --add-service=MysqL firewall-cmd --reload
启动
systemctl start mariadb
开机自启动
systemctl enable mariadb
安全设置
MysqL_secure_installation //初始安装root是空密码,直接回车 Enter current password for root (enter for none): //设置新密码 Set root password? [Y/n] Y New password: *** Re-enter new password: *** //是否删除匿名用户 Remove anonymous users? [Y/n] Y //禁止root远程登录 Disallow root login remotely? [Y/n] Y //删除test数据库 Remove test database and access to it? [Y/n] Y //重新加载权限表 Reload privilege tables now? [Y/n] Y
为安全root仅限本地登录,根据需要可以新建一个有管理员权限的远程用户
MysqL -uroot -p GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '登录密码' WITH GRANT OPTION; FLUSH PRIVILEGES; exit;