当我的Spring Boot应用程序试图连接到MySQL-database时,它抛出一个CommunicationsException: spring-service_1 | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
spring-service_1 |
spring-service_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has n
我一直试图在后端(在Spring上运行)容器和预先构建的MySQL容器之间建立连接。但是,我不能让它连接起来。我的停靠者撰写文件是:
version: '3.7'
services:
test-mysql:
image: mysql
restart: always
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_DATABASE: testdb
MYSQL_USER: test
MYSQL_PASSWORD: test
M
我有下面的docker-compose
version: '2'
services:
cryptohds:
image: cryptohds:cryptohds-2.0.0-SNAPSHOT
environment:
- APP_SLEEP=10 # gives time for the database to boot before the application
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver
我有一个使用JDBC运行的应用程序,并从MySQL获取数据,但是由于这个错误,我无法构建它:
java.sql.SQLException: Unknown system variable 'query_cache_size'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[mysq
我想对我们所有的Spring服务进行对接,但是将问题与Amazon MySQL连接起来。
问题在于与Amazon实例的通信。奇怪的是,如果我使用java命令java -jar service.jar运行java -jar service.jar文件,一切都按预期工作。错误的堆栈跟踪:
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds