Java program porting to Linux system, there is no connection error MySQL. Tip Communications Link FAILURE20 program is running under Windows, but under Linux, there are error prompts communications link failure. Last packet sent to the server was 0 ms ago. In which, the MySQL driver can load normally,
Connection connect = drivermanager.getconnection ("Jdbc:mysql://localhost:3306/iems", "root", "123.com"); There was an exception to this sentence.
Looked at a number of solutions, not threading issues, nor connection time issues. The firewall is also closed. Ask the expert to help answer, thank you
Last packet sent to the server is 2 ms ago solution attempted reconnect 3 times. Giving up. Solution
must first determine whether the URL and username password is configured correctly, look at the connection string, the port is configured correctly
and then use the URL on the Internet to prefix the autoreconnect=true
jdbc:mysql:/ /localhost:3306/oa?autoreconnect=true
or
edit the MySQL directory: my.cnf (My.ini under Windows), plus
wait_timeout= 31536000
interactive_timeout=31536000