mysql连接异常:The server time zone value '?й???????&

时间:2021-07-15 02:14:03

错误原因:mysql识别时区出现错误,这是因为访问的url中没有指定时区为UTC

出错误的url:

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/springbootdemo?useUnicode=true&characterEncoding=utf8

在后面添加时区的参数数即可:

spring.datasource.url=jdbc:mysql://127.0.0.1:3306/springbootdemo?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC