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服務器訪問。

 

如果我的方案結局了您的問題,麻煩請您給點個贊吧!

 

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