解決在pycharm database中使用MySQL報錯
阿新 • • 發佈:2021-01-05
專案場景:
通過pycharm中的database外掛,視覺化使用MySQL
問題描述:
Cannot connect to “local_mysql”. 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部分版本的時區和我們系統的時區不一致造成的
解決方案:
1. 下載時區檔案
下載連結:
其中藍色區為MySQL 5.6以下版本對應的時區檔案,紅色為5.7以上對應的時區檔案
2. 開啟MySQL
在命令列輸入:mysql -uroot -p****
開啟MySQL,其中“****”為使用者密碼
3. 修改時區
- 切換資料庫
use mysql;
- 安裝時區檔案
source 路徑\timezone_posix.sql
其中“路徑”為存放timezone_posix.sql檔案的路徑
- 修改時區
SET GLOBAL time_zone = 'Asia/Shanghai';
參考連結: