版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/JYL15732624861/article/details/80868487
- Spring Boot下使用JPA报错:’hibernate.dialect’ not set的解决办法
版本问题,我的配置文件Application.yml,文件中添加
database-platform: org.hibernate.dialect.MySQL5Dialect
- Caused by: com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: The server time zone…
配置文件Application.yml中添加:serverTimezone=UTC
其实这个不是spring boot + mybatis的问题, 其实是为了使MySQL JDBC驱动程序的5.1.33版本与UTC时区配合使用,必须在连接字符串中明确指定serverTimezone。
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?characterEncoding=utf-8&useSSL=false&autoReconnect=false&rewriteBatchedStatements=true&serverTimezone=UTC
username: root
password: 111
jpa:
database: mysql
show-sql: true