问题

使用Idea自带的Database工具连接MySQL数据库出错:Connection to aplanmis@localhost failed.
[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

原因

系统默认的时区与IDEA连接数据库的时区 (MySQL默认时区为UTC) 不一致,
按照格林威治的时间,中国属于东八区时间,领先UTC八个小时,所以说存在8小时的时差。

解决

在URL后面加上 ?serverTimezone=GMT 即可

其它解决办法

上面的解决办法每次连接url都得加上?serverTimezone=GMT,不太方便,这里还查到了一些其它的解决办法,一并列出。

  • 命令行设置time_zone
    在mysql的命令模式下,输入:
set global time_zone='+8:00'
  • 配置文件设置time_zone
    修改配置文件,在[mysqld]下添加或修改一行:
default-time-zone='+08:00'

重启数据库。

  • Idea Database管理工具中,修改 Advanced 中 serverTimezone 的属性值为 Asia/Shanghai

参考:

【1】:连接数据库出错:Connection to student@localhost failed. [08001] Could not create connection to database…
【2】:IDEA连接MySQL8.0数据库时,报错[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

Idea 连接数据库出错Connection to xxx@localhost failed. [08001] Could not create connection to database相关推荐

  1. Connection to @localhost failed. [08001] Could not create connection to database server. Attempt

    Connection to @localhost failed. [08001] Could not create connection to database server. Attempt 当我们 ...

  2. Python连接MySQL数据库部分问题阐述Connection to @localhost failed. [08001] Could not create connection to databa

    简要说明 问题: Connection to @localhost failed. [08001] Could not create connection to database server. At ...

  3. [08001] Could not create connection to database server. Attempted reconnect 3 times.

    现象描述: 在JetBrains的系列产品中,database连接MySQL数据库时,如Idea.DataGrip.GoLand.Pycharm 等等,连接MySQL数据库时会出现如下提示: 连接失败 ...

  4. 08001] Could not create connection to database server. Attempted reconnect 3 times.

    现象描述: 在JetBrains的系列产品中,database连接MySQL数据库时,如Idea.DataGrip.GoLand.Pycharm 等等,连接MySQL数据库时会出现如下提示: 连接失败 ...

  5. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.解决办法

    pycharm中database连接MySQL数据库时出现如下提示: [08001] Could not create connection to database server. Attempted ...

  6. WebSocket connection to ‘ws://localhost:8080/api/handler‘ failed: Invalid frame header

    vue 项目启动成功后chrome一直不停的报错 WebSocket connection to 'ws://localhost:8080/api/handler' failed: Invalid f ...

  7. WebSocket connection to ‘ws://localhost:3000/ws‘ failed: Error in connection establishment: net::ERR

    出现的错误情况: vue创建项目打开页面后可以运行正常,就是控制台一直隔几秒报websocket的connection错误 错误如下: WebSocket connection to 'ws://lo ...

  8. vue.js WebSocket connection to ‘ws://localhost:3000/‘ failed: WebSocket is closed due to suspension.

    报错 客户端 Safari 版本 13.0.1 (14608.2.11.1.11) 场景重现 点击切换页面,vue.js 就报错这个提示.但放到线上去又不会有. WebSocket connectio ...

  9. 连接数据库出错:java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/

    连接数据库出错 java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ 今天在做Java we ...

  10. java.sql.SQLException: Access denied for user ‘xxx‘@‘localhost‘ (using password: YES)

    错误日志: java.sql.SQLException: Access denied for user 'xxx'@'localhost' (using password: YES)at com.my ...

最新文章

  1. 20172318 2017-2018-2 《程序设计与数据结构》实验3报告
  2. 虚拟机win7装oracle,win7系统安装Oracle VM VirtualBox虚拟机的操作方法
  3. Rust 1.27支持SIMD
  4. 虚拟化:企业信息化建设中坚力量
  5. javaweb如何定位
  6. org-mode入门教程
  7. 标题显示字数限制 html css,【紧急】我想问一下HTML的TITLE标签,里面的内容能填写多少个?有限制吗_html/css_WEB-ITnose...
  8. 在线编码工具_我希望在开始编码时就已经知道的工具
  9. java selenium_关于selenium的介绍
  10. MSE(Media Source Extensions)介绍
  11. 每日一道python的leetcode:冒泡排序
  12. SHA1算法原理(转载)
  13. phpQuery采集乱码问题解决方案
  14. 网络安全笔记-网络设备专场(路由器、交换机、防火墙)
  15. android开源代码
  16. 40岁后学习编程是否太晚了?7点技巧让学习变得轻松有趣
  17. python 法律检索_Python爬虫进阶必备 | 某裁判文书检索网站加密分析与自动登录实现...
  18. verilog hdl高级数字设计(一)
  19. OSPF路由协议及工作原理(一)
  20. js提交成功后,清空表单

热门文章

  1. 市场营销渠道含义是什么?
  2. app 显示未验证应用解决
  3. java人民币数字转换中文大写(精确到人民币大写分)
  4. 飞思卡尔RTI实时中断模块
  5. LANP+KEEPALIVED集群(三)
  6. PTA甲级 1114 Family Property (25 point(s))
  7. Adobe illustrator 常用菜单命令和快捷键
  8. Python代码打包在xp系统上运行~~
  9. python求15 17 23 65 97的因数_pythonlearning
  10. 苹果微信cookie传不到服务器,基于微信公共号开发遇到的cookie问题解决方案小记...