1. 程式人生 > 其它 >Java 掉坑之The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represents more than one time zone

Java 掉坑之The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represents more than one time zone

技術標籤:Java 筆記掉坑裡面了javamysqljdbcbug

java連線mysql出現的問題,已解決√


問題:

The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents more than one time zone

在這裡插入圖片描述


解決方案:

這是因為l我使用的mysql是8.x的版本,出現了時區的錯誤,好像使用mysq6.X+的版本都需要在URL後面新增:serverTimezone=UTC

下面是我新增後的

dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test_xy?useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC"
);

一點點筆記,以便以後翻閱。