1. 程式人生 > >MySQL 8.0.x連線The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents..錯誤解決

MySQL 8.0.x連線The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents..錯誤解決

今天為電腦裝了新的MySQL 8.0.13,整個安裝過程到啟動mysql服務非常順利,然後用DBeaver(也是一個數據庫視覺化連線工具,像Navicat、MySQL Workbench一樣)連線本地嘗試一下,結果報了下面的錯:
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.


瞬間就看懵了,然後去網上搜了一下,發現遇到這個問題的人不少,但是很多部落格給出的答案都是在JDBC連線的url上新增時區什麼的,試了一下也沒什麼卵用。。。不過皇天不負有心人,最後找到了一個好的解決方式:
1、先通過cmd(windows)使用mysql -uroot -p進入mysql;
2、輸入下面命令查詢time_zone:
show variables like '%time_zone%'
在這裡插入圖片描述
3、執行下面命令修改time_zone的Value:
set global time_zone='+8:00';

完了之後,查詢的time_zone應該跟上面截圖的結果一樣,然後就好了,連線就成功了。
感覺這個相比於在JDBC連線的url上加東西更好一點,解決的更徹底一點。