IDEA连接数据库失败@localhost failed. [08001] Could not create connection to database server. Attempte

关于IDEA连接mysql数据库失败:
Connection to db1@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

解决办法:在URL后面加上?serverTimezone=UTC

连接成功!

根本原因是因为时区设置的问题。
UTC代表的是全球标准时间 ,但是我们使用的时间是北京时区也就是东八区,比实际时间要早8小时。

UTC + (+0800) = 本地(北京)时间

发布了232 篇原创文章 · 获赞 302 · 访问量 127万+

猜你喜欢

转载自blog.csdn.net/yang5726685/article/details/103729436