问题描述
![](https://i-blog.csdnimg.cn/blog_migrate/f3feffe27a3931a915f0ac439381c412.png)
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
解决方案
方案1. Tomcat配置VM参数:-Djava.net.preferIPv4Stack=true
方案2. ①Nginx配置代理MySQL:
②修改数据库连接:spring.datasource.url=jdbc:mysql://localhost:9999/demo?characterEncoding=utf8
参考来自:
https://blog.csdn.net/baidu_21349635/article/details/121032229
https://adong.blog.csdn.net/article/details/111501253