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 成功后为:
随机推荐
- [FreeRTOS].FreeRTOS CortexM3 M4中断优先级设置总结
转自:https://blog.csdn.net/xukai871105/article/details/53516857 前言本文将说明在FreeRTOS嵌入式操作系统中,如何设置STM32 Cor ...
- Linux操作系统-CentOS7启动流程和服务管理
Linux操作系统-CentOS7启动流程和服务管理 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.systemd POST --> Boot Sequence --&g ...
- php组合设计模式(composite pattern)
过十点. <?php /* The composite pattern is about treating the hierarchy of objects as a single object ...
- ES6 手册
不用就忘, 把阮大大的地址列在这儿: http://es6.ruanyifeng.com/#README
- 【转】JAVA接口自动化测试之一个测试方法对应多条测试数据的实现方式
一.痛点:一条测试数据对应一个测试方法 前面的章节中我们已经写代码实现了登录接口的处理调用,但是一个接口往往是需要多条测试用例才能完整的覆盖到每一种情况. 针对于单接口多条测试用例需要执行的情况,该如 ...
- Windows下安装Zabbix agent
下载Windows版本的Zabbix agent安装包:https://www.zabbix.com/cn/download_agents#tab:40LTS 有两种安装方式: (1)需要手动安装,安 ...
- P3398 仓鼠找sugar[LCA]
题目描述 小仓鼠的和他的基(mei)友(zi)sugar住在地下洞穴中,每个节点的编号为1~n.地下洞穴是一个树形结构.这一天小仓鼠打算从从他的卧室(a)到餐厅(b),而他的基友同时要从他的卧室(c) ...
- 20180530模拟赛T2——绀碧之棺
题目背景 qiancl 得到了一张藏宝图,上面写了一道谜题. 题目描述 定义\(F(n)\)为 n 在十进制下各个数位的平方和,求区间\([a,b]\)中有多少\(n\)满足\(k\times F(n ...
- keil中error: #70: incomplete type is not allowed—解决方法
今天在写程序的时候,想使用sizeof求数组的大小,数组中其他c文件定义,在头文件使用extern uint8_t buff_value[]; 声明 但是keil编译报错,网上查了,发现,需要写成ex ...
- python面试题&练习题之函数
1.写函数,接收两个数字参数,返回最大值例如:传入:10,20返回:20 def res_max(number1,number2): l1 = [] l1.append(number1) l1.app ...