DataGrip连接数据库mysql报错Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone...

这种问题是Mysql时区问题
MySQL驱动默认UTC时区。

只需要在cmd命令行连接mysql

1.输入

设置全局时区 mysql> set global time_zone = '+8:00';

Query OK, 0 rows affected (0.00 sec)

设置时区为东八区 mysql> set time_zone = '+8:00';

Query OK, 0 rows affected (0.00 sec)

刷新权限使设置立即生效 mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%time_zone%';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | EST |
| time_zone | +08:00 |
+------------------+--------+
2 rows in set (0.00 sec)

2.打开DataGrip连接mysql添加?serverTimezone=GMT%2BB

image.png

3.连接成功!

image.png

你可能感兴趣的:(DataGrip连接数据库mysql报错Server returns invalid timezone. Go to 'Advanced' tab and set 'serverTimezone...)