Could not create connection to database server. Attempted reconnect 3 times. Giving up.
报出这个错误,可能原因:
1、检查MySQL数据库服务是否正常(包含检查服务名和密码),如果不正常,修复至正常为止;
2、maven工程中导入的mysql的jar版本和你的MySQL版本不相符,必须相一致才行!比如,你安装的MySQL是8.x,必须使用高版本对应的mysql-connector-java-8.x.x,同时application.yml里的 driver-class-name: com.mysql.cj.jdbc.Driver
3、连接数据库相关的属性和值不正确或缺失,按照报错提示修改或更新即可。
我在创建spring-boot项目,启动也报同样的错误,但是MySQL服务是正常的,后面检查发现,我的MySQL安装的是版本8.0的,而工程对应的mysql连接jar包是5.1.43版本,将低版本替换为mysql-connector-java-8.0.16.jar,同步更新对应的连接属性,启动成功。
1、将所有的driver-class-name值都从com.mysql.jdbc.Driver修改为com.mysql.cj.jdbc.Driver
2、在url的参数后面新增时区参数:&serverTimezone=UTC
3、修改url连接参数中的值更新为:zeroDateTimeBehavior=CONVERT_TO_NULL.
Could not create connection to database server. Attempted reconnect 3 times. Giving up.的更多相关文章
- 通过dbcp链接池对数据库操作报 Cannot create PoolableConnectionFactory (Could not create connection to database server. Attempted reconnect 3 times. Giving up.)--解决方案
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for ...
- Could not create connection to database server. Attempted reconnect 3 times. Giving up.错误
项目是基于springboot框架,昨天从git上pull代码之后也没有具体看更改的地方,结果运行的时候就报错了. java.sql.SQLNonTransientConnectionExceptio ...
- [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up IDEA2019的database插件无法链接mysql的解决办法(08001错误)
[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.
使用idea连接数据库的时候,报错为 [08001] Could not create connection to database server. Attempted reconnect 3 tim ...
- pycharm2019连接mysql错误08801 ------Connection to django1@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Error:Connection to django1@localhost failed. [08001] Could not create connection to database server ...
- 解决idea中mysql连接失败Could not create connection to database server. Attempted reconnect 3 times. Giving up.
原因是少一个参数,设置时区的. 解决方法: 加一个参数: serverTimezone=UTC jdbc:mysql://localhost:3306/SshProject?useUnicode=t ...
- pycharm连接mysql是出现Connection to orm02@127.0.0.1 failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
下面这个问题反正我是遇到了,也是难为我好几天,于是我决定发一个教程出来给大家看看!希望能帮助你们 原因: 可能是数据库的版本与本机装的驱动不匹配导致的, 解决方案一: 在 url 后面街上一句 因为笔 ...
- pycharm2019连接mysql错误:08801 ------Connection to django1@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
- IntelliJ IDEA连接不上数据库 (Connection to testdb@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.)
问题提示为: 原因:MySQL数据库版本为8.0以上,需要在URL加上时区,即加上?serverTimezone=GMT 成功后为:
随机推荐
- 使用Matplotlab画图
1.绘制折线图 #! /usr/bin/env python#encoding=utf-8 # 用于python2import sys reload(sys) sys.setdefaultencodi ...
- Office--CVE-2017-11882【远程代码执行】
Office远程代码执行漏洞现POC样本 最近这段时间CVE-2017-11882挺火的.关于这个漏洞可以看看这里:https://www.77169.com/html/186186.html 今天在 ...
- zabbix--远程执行命令
zabbix 远程执行命令 重启应用 服务器 使用远程执行命令可以在某些时候帮我做一些事情,达到轻量级的自动化,比如当 nginx.mysql.php.redis.tomcat.等等应用挂掉时帮我们自 ...
- 如何将VOC XML文件转化成COCO数据格式
数据转换实在是个烦人的工作,被折磨了很久决定抽出时间整理一下,仅供参考. 在一个项目中,我需要将已有的VOC的xml标注文件转化成COCO的数据格式,为了方便理解,文章按如下顺序介绍: XML文件内容 ...
- C#WinForm程序异常退出的捕获、继续执行与自动重启
本文参考网上搜索的信息,并做了适当修改可以让捕捉到异常之后阻止程序退出. 另给出了通过命令行自动重启的方法. 如果一个线程里运行下面的代码 ; / a; 将会导致程序自动结束,而且没有任何提示信息 但 ...
- python中的特殊注释#todo与#type
0904自我总结 python中的特殊注释 一.#TODO 这个注释用来快熟找到内容 #todo这里的todo不用区分大小写 写法标记的位置,#todo 备注内容 二.#type a = 1 #typ ...
- Java动态代理-JDK自带实现
上篇文章讲解了什么是静态代理,但是静态代理有一个问题就是需要建立很多的代理类,这样我们需要修改代理的方法的时候,需要在每个类中都要修改,这对于我们来说:当代理类很多的时候工作量就会成倍的增加. 于是针 ...
- scala简单的功能实现~weekone
以下是scala简单的入门题~ 1.⼀个数字如果为正数,则它的signum为1:如果是负数,怎么signum为-1:如果是0,则signum 为0.编写⼀个函数来计算这个值. object Test ...
- PLSQL 美化规则文件详解
PL/SQL中有个代码优化的功能,里面可以定义规则,挺好用的,跟大家分享下: 1.首先新建一个my.br文件,在文件中复制以下内容 Version=1 RightMargin=90 Indent=4 ...
- python预课01 turtle学习
Turtle命令: import turtle # 导入模块 t = turtle.Pen() # 生成画笔 t.speed() #设置速度0-10:0最快 t.forward() # 前进 t.ba ...