# 重启
service firewalld restart
# 开启
service firewalld start
# 关闭
service firewalld stop
# 查看firewall 服务状态
systemctl status firewall
# 查看防火墙
firewall-cmd --list-all
开启服务器3306对外开放后,还需要设置数据库用户授权
MariaDB 开启远程连接
在数据库mysql 中的user表中可以看到默认是只能本地连接的,所有可以添加一个用户
# 针对ip
create user 'root'@'192.168.10.10' identified by 'password';
#全部
create user 'root'@'%' identified by 'password';
建议还是针对于ip开放吧,不要全部开放
授权用户:
# 给用户最大权限
grant all privileges on *.* to 'root'@'%' identified by 'password';
# 给部分权限(test 数据库)
grant all privileges on test.* to 'root'@'%' identified by 'password' with grant option;
# 刷新权限表
flush privileges;
# show grants for 'root'@'localhost';