如何修复“[08S01] 通信 link 失败最后一个成功发送到服务器的数据包是 0 毫秒前。”

How to fix " [08S01] Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. "

我正在使用 PhpStorm + DataGrip + MySQL + WAMP 开发一个 PHP 项目,从那时起我就可以正常使用具有这些配置的远程数据库(见图片):

但我突然收到这个错误:

[08S01] Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. java.net.ConnectException: Connection refused: connect

有人知道我该怎么做才能解决这个错误吗?

我已经尝试执行我在此处找到的操作 (Solving a "communications link failure" with JDBC and MySQL),但还没有成功。

我希望再次正常连接到我的数据库。

您好,此错误是因为您 运行 是 MySQL 版本 5 或 8.0 及更高版本。并且您的服务器配置为使用 TLS 1.2 协议。因此,您需要启用 TLS 协议。

  • 打开 Datagrip
  • 转到属性
  • 数据源 > 高级

enabledTLSProtocol中设置值:

TLSv1,TLSv1.1,TLSv1.2,TLSv1.3

测试连接。并且应该有效!