ghaction-setup-docker
ghaction-setup-docker copied to clipboard
Mysql cannot be connected via jdbc in macos13
Behaviour
Steps to reproduce this issue
1.Set up Docker Buildx
- name: Set up Docker Buildx uses: crazy-max/ghaction-setup-docker@v3
2.set up
- if: inputs.DB-name == 'MySQL' && runner.os == 'Linux'
name: Start MySQL Service
shell: bash
run: |
docker run --name mysql1 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0.26
docker run --name mysql2 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3307:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0.26
docker run --name mysql3 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3308:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0.26
3.the jdbc code
String connUrl =
password == null ? String.format("jdbc:%s://%s:%s/?user=%s", engine, meta.getIp(), meta.getPort(), username)
:
String.format(
"jdbc:%s://%s:%s/?user=%s&password=%s",
engine, meta.getIp(), meta.getPort(), username, password);
try {
Class.forName(relationalMeta.getDriverClass());
DriverManager.getConnection(connUrl);
Expected behaviour
can connect to Mysql through jdbc
Actual behaviour
- all mysql are healthy
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
mysql:8.0.26 "docker-entrypoint.s…" 3 minutes ago Up 3 minutes (healthy) 33060/tcp, 0.0.0.0:3308->3306/tcp, :::3308->3306/tcp mysql3
mysql:8.0.26 "docker-entrypoint.s…" 3 minutes ago Up 3 minutes (healthy) 33060/tcp, 0.0.0.0:3307->3306/tcp, :::3307->3306/tcp mysql2
mysql:8.0.26 "docker-entrypoint.s…" 3 minutes ago Up 3 minutes (healthy) 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp mysql1
Configuration
- Repository URL (if public):
- Build URL (if public):
# paste your YAML workflow file here and remove sensitive data
Logs
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:519)
at com.mysql.cj.protocol.a.NativeProtocol.readServerCapabilities(NativeProtocol.java:475)
at com.mysql.cj.protocol.a.NativeProtocol.beforeHandshake(NativeProtocol.java:362)
at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1350)
at com.mysql.cj.NativeSession.connect(NativeSession.java:132)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818)
... 40 more
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:67)
at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63)
at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:45)
at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:513)
... 46 more