使用MySQL的异常错误

问题

今天连接MySQL数据库时控制台突然报错,显示为:

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.

这里可以看出是时间区域的问题。

解决方法

在配置数据库的连接信息中,在MySQL的URL后面加上“?serverTimezone=UTC“,即是:

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

你可能感兴趣的:(MySQL,MySQL,Spring)