Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解决
网上说法:
1、修改my.cnf:
[mysqld]
wait_timeout=31536000
interactive_timeout=31536000
将过期时间修改为1年。
2、在连接URL上添加参数:&autoReconnect=true&failOverReadOnly=false
都没有解决。。。
然后仔细查了下原因,是mysql中没有这个库。
请各位不要犯我同样的错误。
1、查数据库连接
2、查是不是有此数据库
3、看看自己是不是连接人家的数据库,配置里却写得localhost