现象:
今天在Pycharm中安装了DB Navigator,连接数据库时出现报错:
Cannot connect to "Connection". 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驱动中的默认时区是UTC。
UTC代表的是全球标准时间 ,但是我们使用的时间是北京时区也就是东八区,领先UTC八个小时。因为时区不一致,所以提示时区不一致。
解决方法:
根据提示需要在配置数据库的连接信息中,在MySQL的URL后面加上时区信息“serverTimezone=UTC” ,
具体步骤:
1、点击 “Settings”
2、点击 “Properties”,添加URL连接的键:serverTimezone 和 值:UTC,点击测试,连接成功。