相关推荐recommended
Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.
作者:mmseoamin日期:2023-12-13

Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure 解决方法

一、 5.7版本之前的 mysql连接驱动使用的是

com.mysql.jdbc.Driver

二、 8.0版本之后的mysql连接驱动使用的是

com.mysql.cj.jdbc.Driver

三、出现 Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure 错误,8.0版本之后的url后需补充参数,结果如下:

jdbc:mysql://localhost:3306/spring6?useUnicode=true&characterEncodeing=UTF-8&useSSL=false&serverTimezone=GMT