Tag Archives: Learning java

[Solved] You must configure either the server or JDBC driver (via the ‘serverTimezone‘ configuration proper

This error occurs when running the example
2021-06-25 10:14:14.571 ERROR 10096 — [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: The server time zone value ‘�й���׼ʱ��’ 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.] with root causeSolution:

add the following codes to application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/you_mysql?serverTimezone=UTC