navicat连不上阿里云mysql数据库

1.阿里云后台安全实例,添加开启mysql端口3306,入方向

2.登录到mysql, 授权外部可链接

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

FLUSH PRIVILEGES;

 

3.修改my.cnf配置[mysqld中]。添加

bind-address = 0.0.0.0

 

4.重启mysql,/etc/init.d/mysql restart 

 

打开端口:

iptables -I INPUT -i eth0 -p tcp --dport 3306 -j ACCEPT    #开放3690端口

>/etc/init.d/iptables save #保存配置

service iptables save  #保存iptable规则

启动防火墙:

systemctl start firewalld # 启动,

  systemctl enable firewalld # 开机启动

  systemctl stop firewalld # 关闭

  systemctl disable firewalld # 取消开机启动

或者:

3、防火墙检测
1)iptables --list查看;
2)开启防火墙3306端口
vi /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT(允许3306端口通过防火墙)
/etc/init.d/iptables restart(重启防火墙使配置生效)
3)或者直接关闭防火墙; 参考:http://blog.csdn.net/fjssharpsword/article/details/50973283
centos 7 以后是修改 firewall
systemctl start firewalld # 启动,

systemctl enable firewalld # 开机启动

systemctl stop firewalld # 关闭

systemctl disable firewalld # 取消开机启动

 

 

5.还不行就重启服务器。

 

posted on 2019-03-05 12:36  paly76  阅读(1484)  评论(0编辑  收藏  举报

导航