DB:
$ mysql --version
mysql Ver 14.14 Distrib 5.6.27, for osx10.10 (x86_64) using EditLine wrapper
Spring Boot: 2.1.1.RELEASE
The
Another way is to put into the file application.properties
the next line:
spring.jpa.properties.hibernate.jdbc.time_zone=UTC
It comes as an option in: https://www.baeldung.com/mysql-jdbc-timezone-spring-boot
Set useLegacyDatetimeCode
false and set ServerTimezone.
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/avmaint-local?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
I've run into the same issue but adding
?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
after your schema name fixed this issue for me. Should look something like this
spring.datasource.url = jdbc:mysql://localhost:3306/my-schema-name?useSSL=false&serverTimezone=UTC&useLegacyDatetimeCode=false
I'm currently using MySQL v8 and this works well for me.
I'm using MySQL 8 and solved this question by injecting the value of the user.timezone property.
Using Java 8 in my project.
Relevant settings in appliction.properties:
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
spring.datasource.url=jdbc:mysql://localhost:3306/mudi?serverTimezone=${user.timezone}
Using 2.3.4.RELEASE as parent project.
Dependencies used:
HTH,
WB::
Add useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false
to your connection string:
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/avmaint-local?useSSL=false&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC