mysql - 如何解决这个 pom.xml 问题? (连接到数据库)

标签 mysql database maven jpa java-11

我正在使用:MySQL Workbench 8.0、Spring Tool Suite 3.9.7 和 JDK 11。(这是我拥有的一切)

我想创建数据库连接,但我收到此错误:

java.sql.SQLException: The server time zone value 'Közép-európai téli idõ' 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.

完整的错误在这里:https://hastebin.com/zimibuvafa.sql

应用程序属性

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://localhost:3306/test1
spring.datasource.username=root
spring.datasource.password=adam
spring.mvc.view.prefix: /jsp/
spring.mvc.view.suffix: .jsp
spring.jpa.show-sql=true

密码、用户名、测试名称正确。

pom.xml:https://hastebin.com/oyufeporit.xml

最后,我用实体类创建了一个正确的实体包。 (因为 os 连接)--> @Entity、Getters-Setter 等

谢谢你所做的一切。

亚当

最佳答案

更换线路

spring.datasource.url=jdbc:mysql://localhost:3306/test1

jdbc:mysql://localhost:3030/db?test1=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

并添加另一行spring.datasource.driverClassName=com.mysql.jdbc.Driver

关于mysql - 如何解决这个 pom.xml 问题? (连接到数据库),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54448625/

相关文章:

mysql - 导入 WordPress 数据库 - #1075 - 不正确的表定义;只能有一个自动列,并且必须将其定义为键

mysql - P2P应用数据库

java - Eclipse tycho 将版本更新为 svn 修订版

maven - 如何为插件的不同执行提供不同的属性集?

java - SLF4J:加载类 "org.slf4j.impl.StaticLoggerBinder"失败。在一个 Maven 项目中

php - LessQL 中的自定义查询

mysql - 在同一地区找到至少 2 位顾客,他们至少喜欢一种用 SQL 出售的比萨饼

php - 如何在sql中按顺序获取数字?

sql - 如何查询从表 A 或表 B 中获取值?

sql - 使用 SQL 数据库作为单词词典