今天用datagrip连接linux的mysql的时候失败了
datagrip显示的如下如所示
报的错是
[08S01]
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packetsfrom the server.
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packetsfrom the server.
翻译过来之后也是依托答辩(对于英语菜的我完全看不懂)
一顿操作无果
最后发现需要把linux的防火墙给关了
关闭linux防火墙的命令为
systemctl stop firewalld.service
我们执行如上命令之后
再重新测试连接数据库,发现连接成功了
我们再拓展一下linux部分和防火墙有关的命令
Centos7之前的版本 | Centos7 | |
开启防火墙 | service iptables start | systemctl start firewalld.service |
关闭防火墙 | service iptables stop | systemctl stop firewalld.service |
重启防火墙 | service iptables restart | systemctl restart firewalld.service |
查看防火墙状态 | service iptables status | systemctl status firewalld.service |
但是这里我们需要知道的是
对于Centos7之前的版本,是有永久打开/关闭防火墙的,而Centos7没有
永久打开防火墙 | chkconfig iptables on |
永久关闭防火墙 | chkconfig iptables on |
同样的Centos7有以下几个,而Centos7以前的没有
开机启动防火墙 | systemctl enable firewalld.servise |
开机禁用防火墙 | systemctl disenable firewalld.servise |
查看防火墙是否开机 | systemctl is-enabled firewalld.servise |