1.修改root 的host 将localhost改为%
# 切换数据库
use mysql;
update mysql.user set host = '%' where user = 'root';
2.配置安全组
开启3306端口
3.防火墙配置
# 检查状态
systemctl stauts firewalld.service
# 其余还有 开始,重启等
systemctl start firewalld.service
systemctl restart firewalld.service
# 开机自启动
systemctl enable firewalld.service
#配置防火墙
firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl restart firewalld.service
firewall-cmd --query-port=3306/tcp # 检查是否ok