[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
程序员文章站
2022-05-01 15:54:14
...
今天想尝试用idea的Database连接数据库
当我继续操作的时候发现我的数据库连接不上[08001]
然后我发现配置文件里的写法是这样的
url: jdbc:mysql://localhost:3306/analogy?serverTimezone=UTC
在后面加上了一个时差的设置
连接数据库的时候一定要把时区设置好
UTC代表的是全球标准时间 ,但是我们使用的时间是北京时区也就是东八区,领先UTC八个小时。
//北京时间==东八区时间!=北京当地时间
serverTimezone=GMT%2B8
//或者使用上海时间
serverTimezone=Asia/Shanghai
设置完时区后,我就成功的连接上了
上一篇: mysql免安装版安装
推荐阅读
-
pycharm连接mysql是出现Connection to orm02@127.0.0.1 failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
-
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
-
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
-
idea连接MySQL报错Could not create connection to database server. Attempted reconnect 3 times. Giving up.
-
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
-
pycharm连接mysql是出现Connection to orm02@127.0.0.1 failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
-
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.