Configure Mysql Tiimezone in Spring Boot

Asked

Viewed 1,120 times

0

PROBLEM

How do I set up Mysql Timezone in a project using Spring Boot with Tomcat?

ERROR

java.sql.SQLException: The server time zone value 'Hora oficial do Brasil' 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.
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.13.jar:8.0.13]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.13.jar:8.0.13]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.13.jar:8.0.13]
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.13.jar:8.0.13]
    a

1 answer

1


Good afternoon, all right?

Insert the line below in application properties :

spring.datasource.url=jdbc:mysql://localhost:3306/seubanco?useTimezone=true&serverTimezone=UTC

do not forget to change the your bank for your database name (schema)

  • 1

    It worked. Thank you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.