Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.

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

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://net2asp.com/dd7198236d.html