java - spring boot jdbc服务器时区值 'Jerusalem Standard Time'无法识别

标签 java spring spring-boot jdbc spring-jdbc

这是我第一次在 Spring Boot 中使用 jdbc,所以我遵循了本指南: https://spring.io/guides/gs/accessing-data-mysql/

一切看起来都很好,直到我尝试编译它并收到此错误:

The server time zone value 'Jerusalem Standard Time' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.

最佳答案

我认为您需要在 spring.datasource.url = ... 行的 application.properties 中添加 ?serverTimezone=IST

spring.datasource.url=jdbc:mysql://localhost:3306/db_example?serverTimezone=IST

关于java - spring boot jdbc服务器时区值 'Jerusalem Standard Time'无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53842043/

相关文章:

java - 用多态类替换 switch

java - 在 Spring 中验证数字

java - 如何在Spring Boot中从实体类调用基于服务的类

java - Spring Boot + SPring REST + Swagger + JPA + 内存中 H2 DB

java - 如何使用 javafx 隐藏或停用 TextField 和 Label

java - 如何通用地实现存储在 HashMap 中的调用方法?

spring - 初始大小 BasicDataSource

java - Spring Boot保存将学生分配到一个组

java - 如何将 html 输入保存到列表中并在每次提交时显示?

java - 在Java中表示可变长度矩阵(二维数组)的最佳方式?