连接mysql数据库报错:java.sql.SQLException: The server time zone value

**

背景

**
项目使用的是springboot集成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 

解决方案:

在mysql的连接上加上服务器时区:serverTimezone=UTC

datasource.url=jdbc:mysql://localhost:3306/miao?
useUnicode=true&characterEncoding=utf-
8&allowMultiQueries=true&useSSL=false&serverTimezone=UTC

猜你喜欢

转载自blog.csdn.net/zh15732621679/article/details/80697930