使用 Idea 连接 MySQL 数据库、Server returns invalid timezone. Need to set ‘serverTimezone‘ property.

1.使用 Idea 连接 MySQL 数据库

  • 打开 Idea,在页面右端点击 Database

  • 点击 Test Connection

  • 成功连接

2. 遇到的问题 – 时区不对

  • 问题

Server returns invalid timezone. Need to set ‘serverTimezone’ property.

  • 原因
    原因是 MySQ L驱动中默认时区是UTC,与本地时间(中国)相差八个小时,所以链接不上。

  • 解决办法
    也可以在url后添加:?serverTimezone=GMT

    成功解决!

猜你喜欢

转载自blog.csdn.net/Kc635908933/article/details/115084401