org.apache.ibatis.exceptions.PersistenceException:
### Error updating 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 mappers/UserMapper.xml
### The error may involve com.chunqiu.mybatis.mapper.UserMapper.insertUser
### The error occurred while executing an update
### 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.
When we report the first few lines of error information as shown in the figure above, we can try to exclude common errors on the Internet as below:
1. MySQL data service is not enabled
2. serverTimezone parameter
3. wait_timeout settings
If the error is still reported, check whether there is this line after the error message
Caused by: javax.net.ssl.SSLHandshakeException
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171)
at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:106)
at sun.security.ssl.TransportContext.kickstart(TransportContext.java:238)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:410)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:389)
at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:316)
at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188)
at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:352)
... 55 more
Solution:
add the parameter usessl = false to the URL
jdbc:mysql://xxx.xxx.xxx.xxx/db?useSSL=false
Cause:
Communications link failure
Caused by: javax.net.ssl
Before MySQL 5.7, the security was low and there were test libraries that any user could connect to, so the official version 5.7 increased the privacy protection. The default value of useSSL = true was used to prevent arbitrary changes to the database. In version 8.0, SSL is still retained and the default value is true, so just set “?useSSL= false” and you’re done!
Read More:
- [Solved] MySQL connection error: communications link failure
- [Solved] Druid connection pooling Error: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
- CommunicationsException: Communications link failure [How to Solve]
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- host ‘‘ is not allowed to connect to this mysql server Connect MYSQL Error
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- MYSQL Enter password:ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘
- MySQL Install Error: MySQL error 1042: Unable to connect to any of the specified MySQL hosts
- C# Connect MYSQL Error: MySql.Data.MySqlClient.MySqlException:“SSL Connection error.”
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- How to Solve c3p0 connect mysql8.0 Error
- Ubuntu ERROR 2003 (HY000): Can’t connect to MySQL server on ‘127.0.0.1’ (111)
- SqlSugar Connect MySql 8.0.29 Error [How to Solve]
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
- MySQL Change password failure prompt: ERROR 1064(42000):You have an error in your SQL syntax: check the corresponds to your M