liunx centos 防火墙
查看防火墙状态
systemctl status firewalld
查看已经开放的端口
firewall-cmd --list-ports
添加端口3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
重启防火墙
firewall-cmd --reload
数据库开放账号可以外网登陆
mysql -u root -p
# 首先登录上mysql
use mysql;
select user,host from user where user='root';
update user set host='%' where user='root';
# 刷新权限
flush priveleges
#FLUSH PRIVILEGES;# 允许root用户远程连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '数据库密码' WITH GRANT OPTION;