CentOS7.4安装mariadb10.2

官方安装说明mysql

添加源sql

vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

安装数据库

yum install MariaDB-server

防火墙设置centos

firewall-cmd --zone=public --permanent --add-service=mysql
firewall-cmd --reload

启动安全

systemctl start mariadb

开机自启动url

systemctl enable mariadb

安全设置centos7

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仅限本地登陆,根据须要能够新建一个有管理员权限的远程用户code

mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '登陆密码' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
相关文章
相关标签/搜索