用Idea连接MySQL时,报错
Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone' property
方法一:
在mysql的命令行窗口输入以下命令:
show variables like '%time_zone%';
set global time_zone = '+8:00';
应该是版本的问题,需要改一下时区才正常。
方法二:
在写配置文件中的url时,添加时区信息serverTimezon=UTC
spring:
datasource:
username: root
password: root
url: jdbc:mysql://localhost:3306/mybatis?serverTimezon=UTC&useUnicode=true&characterEncoding=utf-8