数据库是没问题的,我在本地电脑通过ip+3306就能连接到这个数据库,在项目中使用localhost或者ip都连接不上。一直报错这个:
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
The error may exist in liuyuyang/net/mapper/OssMapper.java (best guess)
The error may involve liuyuyang.net.mapper.OssMapper.selectOne
The error occurred while executing a query
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
难道是启动命令有问题吗:java -jar blog.jar --PORT=9003 --DB_INFO=47.93.190.5:3306/blog
关键是我在宝塔和docker以及本地电脑都正常