MySql 客户端连接失败
MySQL "Communications link failure Last packet sent to the server was 0 ms ago"
Environment
System
ProductName: Mac OS X
ProductVersion: 10.14.6
MySql
Your MySQL connection id is 42
Server version: 8.0.22 Homebrew
Issue
使用数据库客户端进行连接时,提示连接失败
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Resolution
以下之一可能会提供解决方案
•刷新DNS
•启动(或重新启动)数据库
•禁用防火墙和/或配置防火墙/代理以允许/转发端口。
•DBA可能需要直接与MySQL支持部门一起工作。
Diagnostic Steps(诊断步骤)
应验证以下内容:
•JDBC URL中的端口号正确
•JDBC URL中的主机名被本地DNS服务器识别
由于之前使用 SwitchHosts 将 localhost 删除掉(原因使用 Charles 抓包无法抓取 localhost 域名的请求)
参考: https://access.redhat.com/solutions/18015