在阿里云租了个服务器(ubuntu环境),配置好了mysql数据库,可以增删改查,一切完好,但是在我本机远程连接这个mysql时,产生如下问题:
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
上网搜索解决办法:
将/etc/mysql/my.cnf配置文件加上:
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000
保存
然后重启mysql
再在我的电脑上连接这个mysql,仍然出现这个问题(实例开启了3306端口(入规则),配置出规则了也没有用):
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
有遇到过这个问题的大佬吗???
1.为了安全通常是禁止数据库服务端口监听在公网的,即使做了认证机制也太危险了。
2.你本地连不上公网mysql服务看看mysql是否监听在你阿里云服务器公网ip或者
0.0.0.0
,如果已经监听在公网,就再看看是否开了防火墙,看看阿里云管理平台看看是不是你的服务器有什么网络安全策略,导致你从本地连接不了你服务器公网的3306端口。