解决Error querying database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: 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.
The error may exist in com/mt/dao/UserMapper.xml
The error may involve com.mt.dao.UserDao.getUserList
The error occurred while executing a query
Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
困扰了两天,这是连接数据库的问题,建议大家使用mysql5.7的版本不然会报一些没遇到的错,这种错往往需要自己去探索。。。。
useSSL=false
MySQL在高版本需要指明是否进行SSL连接
1.true 需要连接
2.false 不需要连接
原因是MySQL在高版本需要指明是否进行SSL连接。
SSL协议提供服务主要:
1)认证用户服务器,确保数据发送到正确的服务器; .
2)加密数据,防止数据传输途中被窃取使用;
3)维护数据完整性,验证数据在传输过程中是否丢失;
当前支持SSL协议两层:
SSL记录协议(SSL Record Protocol):建立靠传输协议(TCP)高层协议提供数据封装、压缩、加密等基本功能支持
SSL握手协议(SSL Handshake Protocol):建立SSL记录协议用于实际数据传输始前通讯双进行身份认证、协商加密
算法、 交换加密密钥等。