本地安装mysql
安全组设置入站规则
服务器iptables 开发3306端口
iptables-services安装
yum install iptables-services
systemctl enable iptables
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
mysql中对ip进行授权
Host 'xxx' is not allowed to connect to this MySQL server.
- 为新用户分配权限
授予用户通过外网IP对于该数据库的全部权限
grant all privileges on
root
.* to 'root'@'%' identified by 'xxx';
- 刷新授权
flush privileges;