【问题标题】:Springboot java application-mysql CommunicationsException: Communications link failureSpringboot java application-mysql CommunicationsException:通信链路故障
【发布时间】:2021-08-08 20:47:05
【问题描述】:

我在将 Java Spring Boot 应用程序连接到 MySQL 数据库时遇到问题,请参阅标题等:java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

我已经在 3 台设备上安装了应用程序,1 台 Linux,2 台 Windows,从来没有遇到过这样的问题。

Java 应用程序在 Debian 10 机器上运行,MySQL 服务器也在那里运行。 Spring数据源地址:jdbc:mysql://localhost:3306/final?useSSL=false&?useUnicode=yes&characterEncoding=UTF-8

在网络统计中:

tcp6       0      0 :::33060                :::*                    LISTEN      32528/mysqld
tcp6       0      0 :::3306                 :::*                    LISTEN      32528/mysqld

我也可以通过 telnet 连接到它。 在 MySQL 中,数据库用户拥有所有权限,所有用户主机设置为 %。 我试过在 MySQL 配置中设置 bind_address,设置用户,没有任何帮助。 试过 ufw allow mysqld, ufw disable too.

我能做什么?

【问题讨论】:

    标签: java mysql linux networking jdbc


    【解决方案1】:

    如果我将 application.properties 从项目中复制到项目旁边的配置文件夹中(也由 springboot 加载),它就可以工作了。

    是springboot的bug?休眠?还是什么?

    【讨论】:

      猜你喜欢
      • 2012-10-14
      • 2012-02-21
      • 2014-12-31
      • 2011-02-28
      • 1970-01-01
      相关资源
      最近更新 更多