小工具知识网

当前位置: 首页 > 行业知识 > com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

行业知识

com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

2026-11-05 23:30:43 来源:互联网转载

一、报错

com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

CommunicationsException 翻译为:通信链路故障

二、原因

但是在mysql高版本中,如果在URL中缺少"useSSL=false"参数可能会导致报错。这是因为MySQL 8.0.33以上的版本默认要求使用SSL(安全套接层)来加密与数据库的连接。

三、解决

在数据源配置文件中,在url后加上useSSL=false

    url: jdbc:mysql://192.168.189.189:3306/xxxx?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai&useSSL=false

重新启动后,问题解决!

上一篇:服务器怎么上传游戏源码?

下一篇:宝塔面板IP修改教程,轻松切换面板IP地址指南