Java 尝试将MySQL服务器连接到Spring Boot应用程序STS时出现多个错误

Java 尝试将MySQL服务器连接到Spring Boot应用程序STS时出现多个错误,java,mysql,hibernate,spring-boot,Java,Mysql,Hibernate,Spring Boot,我正在尝试使用Spring工具套件在Spring Boot中与MySQL服务器建立连接。即使我的数据库正在运行且架构已创建,但仍会出现以下错误: WARN 44756 --- [ restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiati

我正在尝试使用Spring工具套件在Spring Boot中与MySQL服务器建立连接。即使我的数据库正在运行且架构已创建,但仍会出现以下错误:

WARN 44756 --- [  restartedMain] com.zaxxer.hikari.util.DriverDataSource  : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.

ERROR 44756 --- [  restartedMain] com.zaxxer.hikari.pool.HikariPool       : HikariPool-1 - Exception during pool initialization.

WARN 44756 --- [  restartedMain] o.s.b.a.orm.jpa.DatabaseLookup           : Unable to determine jdbc url from datasource

WARN 44756 --- [  restartedMain] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata : The server time zone value 'PDT' 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.

WARN 44756 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
我正在使用以下application.properties:

spring.datasource.url=jdbc:mysql://localhost:3306/book-schema
spring.datasource.username=root spring.datasource.password=root1234
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update

我不确定是什么导致了这个问题。

尝试添加时区,如下所示

spring.datasource.url=jdbc:mysql://localhost:3306/book-schema?serverTimezone=UTC

请参阅添加application.properties、pom.xml和hibernate配置文件(如果存在)我的application.properties文件如下:spring.datasource.url=jdbc:mysql://localhost:3306/book-schema spring.datasource.username=root spring.datasource.password=root1234 spring.datasource.driver class name=com.mysql.jdbc.driver spring.jpa.hibernate.ddl auto=update不确定hibernate配置文件?mysql连接器版本以及pom.xml中的spring启动版本?未指定任何版本!我相信这解决了我的问题,因为我不再收到错误。我读过类似的帖子,但无法找到这样一个简单的修复方法。谢谢!!很高兴能帮助你…很高兴。