MySQLNonTransientConnectionException: Could not create connection to database server.
MySQLNonTransientConnectionException: Could not create connection to database server.
Spring整合mybatis并使用driud数据库连接池,启动测试类就报”MySQLNonTransientConnectionException: Could not create connection to database server.“,检查了一番配置文件没发现问题,而且我之前用过这些配置,按理说没问题。各种百度、谷歌没结果,想起来装了mysql 8.0,估计是这个问题。既然是这个问题,那么问题出在数据库连接驱动,看了下pom文件,发现用的是5.1.4版本,于是找了个8.0.11版本重新启动,果然报错就不一样了。
2018-05-26 16:52:53,928 [Druid-ConnectionPool-Create-1150963491] [com.alibaba.druid.pool.DruidDataSource]-[ERROR] create connection error
java.sql.SQLException: validateConnection false
另外在控制台上还打印了”Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.“,意思是这个驱动类已经过时了,那只能说明MySQL 8.0使用的数据库连接字符串不一样。改完后重新启动搞定。
需要说明的是mysql 8.0版本还对时区有要求,否则启动提示”The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.“
有个别人的示例可以参考下:https://blog.csdn.net/beyond9305/article/details/80330125
贴一下连接字符串
url: jdbc:mysql://localhost:3306/yinliu?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true
driver: com.mysql.cj.jdbc.Driver
MySQLNonTransientConnectionException: Could not create connection to database server.的更多相关文章
- java项目连接jdbc报错:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server
java项目连接jdbc报错:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not creat ...
- jeecg启动报错“com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.”的解决办法
在运行"maven build"-->"tomcat:run"之后,报如下错误: com.mysql.jdbc.exceptions.jdbc4.MySQ ...
- MYsql 8 连接报错 MySQLNonTransientConnectionException: Could not create connection to database server.
本地安装mysql 是8 项目中数据驱动 也要求是 8 <dependency> <groupId>mysql</groupId> <artifactId&g ...
- 通过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 ...
- MySQL 8.0版本连接报错:Could not create connection to database server.
准备搭建一个Spring Boot 组合mybatis的项目,数据库采用的是MySQL 8.0.11按照以往的配置,使用插件mybatis-generator-maven-plugin生成代码时,一直 ...
- jmeter连接mysql数据库报错Cannot create PoolableConnectionFactory (Could not create connection to database server.)
今天在学习jmeter的jdbc取样器,发现在配置完JDBC Connection Configuration和JDBC Request后,点击运行.在查看结果树中显示响应数据: Cannot cre ...
- Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Could not create connection to database server.
报错信息:Could not open JDBC Connection for transaction; nested exception is org.apache.commons.dbcp.SQL ...
- 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. 点击这里 ...
随机推荐
- python 使用夜神模拟器
安装版本为6.2.8.0 1.模拟器安装证书 打开模拟器,点击浏览器 在浏览器里输入:mitm.it 出现如下: 选择安卓进行安装 比如:sks123 2.设置代理 输入密码:sks123 上面刚才设 ...
- NPU TPU
https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet
- linux下如何使用adb连接在qemu中运行的安卓系统?
1. 运行安卓系统, 如下: $sudo qemu-system-x86_64 -m 4096 -boot d -enable-kvm -smp 3 -net nic -net user,hostfw ...
- Linux下安装java及配置(yum安装)
1.查看java的所有版本:yum list java* 2.安装免费版1.8: yum install java-1.8.0-openjdk.x86_64 3.配置java环境 JAVA_HOME= ...
- RocketMQ、Kafka、RabbitMQ的对比
RocketMQ 相比于 RabbitMQ.Kafka 具有主要优势特性有: 支持事务型消息(消息发送和DB操作保持两方的最终一致性,RabbitMQ 和Kafka 不支持) 支持结合 RocketM ...
- wordpress 访问其他数据库
有时候我们需要在 Worpdress 中访问其他服务器上的数据库时,可以使用以下方式,在 functions.php 中添加如下代码: // 输入数据库配置参数$mydb = new wpdb('us ...
- golang教材
https://golangbot.com/buffered-channels-worker-pools/ https://golang.org/doc/ https://medium.com/go- ...
- Java13新特性 -- 重新实现旧版套接字API
全新实现的 NioSocketImpl 来替换JDK1.0的PlainSocketImpl. 它便于维护和调试,与 NewI/O (NIO) 使用相同的 JDK 内部结构,因此不需要使用系统本地代码. ...
- IfcEdge
/* Generated By: IFC Tools Project EXPRESS TO JAVA COMPILER: Do not edit this file!! */ package ifc2 ...
- Executors创建四种线程池
newCachedThreadPool创建一个可缓存线程池,如果线程池长度超过处理需要,可灵活回收空闲线程,若无可回收,则新建线程.newFixedThreadPool 创建一个定长线程池,可控制线程 ...