The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received

报错信息:

com.alibaba.druid.pool.DruidDataSource -346367553 [Druid-ConnectionPool-Create-3454745]

- init datasource error, url: jdbc:mysql://192.168.0.5:3306/ 

ERROR com.alibaba.druid.pool.DruidDataSource  - create connection error
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.

 

错误背景:

A是应用服务器,B是数据库服务器

运营商:移动云、

数据库:mysql5.6

如果不是这样的背景下,你的错误解决办法可能和我不一样。

 

解决办法:设置了服务器安全组,B服务器,也就是数据库服务器,除了设置流入3306安全组,还要设置流出3306的安全组。因为出于安全考虑,B数据库服务器只设置了允许A服务器访问。

 

如果我的方案结局了您的问题,麻烦请您给点个赞吧!

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章