mysql出现The server time zone value '�й���׼ʱ��' is unrecogni...

## 具体问题

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.


## 解决方法

url后面增加:

jdbc.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC

试了很多次这个方法都不管用后来直接修改了时区。

修改数据库时区:

set global time_zone = '+8:00'; ##修改mysql全局时区为北京时间,即我们所在的东8区

set time_zone = '+8:00'; ##修改当前会话时区

flush privileges; #立即生效

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容