当前位置:
首页 >
行业知识 >
数据库连接bug异常:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure异常
行业知识
数据库连接bug异常:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure异常
2026-12-06 00:50:00
来源:互联网转载
1、启动SpringBoot项目出现com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure异常。
2、查询后定位问题是数据库连接不上,服务器异常。
3、方案一:切换数据库为本地地址,重新启动即可。url: jdbc:mysql://127.0.0.1:3306/mysql001?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&allowMultiQueries=trueusername: rootpassword: root
重启后恢复正常。
方案二:重启服务器,恢复数据库服务之后,再重启即可。