转载请注明出处: http://qiudeqing.com/java_web/2016/12/04/java-connect-to-mysql.html

java连接mysql数据库

stackoverflow:

无法获取数据库连接

com.mysql.jdbc.exceptions.jdbc4.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.  at sun.reflect.NativeConstructorAccesso

可能原因:

解决办法:

stackoverflow: com-mysql-jdbc-exceptions-jdbc4-communicationsexception-communications-link-fai

通过mysql show processlist 命令检查mysql锁的方法

http://blog.sina.com.cn/s/blog_54eeb5d90102wf9l.html