1. 程式人生 > 實用技巧 >The server time zone value ‘�й���׼ʱ��‘ is unrecognized or represents more than one time zone.

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

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.

異常資訊

出現異常原因:

使用mysql的jdbc驅動最新版(6.0+)時,會遇到資料庫和系統時區差異引起的問題。

解決方案:

在配置檔案(application.yml)中的,配置資料庫時在jdbc的url後面加上一條serverTimezone=CST
CST代表的是中國上海時間(與北京時間,東八區相同)。
資料庫datasource配置