##关于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) = 本地(北京)时间
</div>
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-60ecaf1f42.css" rel="stylesheet">
</div>