Unable to connect to Docker containers in DBeaver

Hi all,

What I thought would be a routine task is already costing me half a day, and I have no idea what else I can try. I’m assuming it’s a networking problem, but I’ll let you be the judge.

This is my docker-compose.yml:

services:
  database:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: wbfeu
      MYSQL_ROOT_PASSWORD: root
    ports:
      - "3306:3306"

Brought up the container, seems to be working fine:

$ docker exec -it server-database-1 mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
...
mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| wbfeu              |
+--------------------+
5 rows in set (0.01 sec)

Then, preparing a MySQL connection in DBeaver, I set host to localhost or 127.0.0.1 (tried both), username and password to root.

I keep getting

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.
  Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

Also tried the same procedure with Postgres and MariaDB containers, and while errors are slightly different, I believe the problem is the same.

When I had the MariaDB container up, the error contained something like Can't connect to local server through socket.

Any ideas?

I suggest you read the docs

I wish it was that simple. I read the documentation page you linked, but there was not much there that I didn’t know yet. The exact same set-up works perfectly on my work laptop, so I’m very confused what could be different on my personal desktop. Happy to ask the same question to the DBeaver community if my question is out of place here.

Problem is solved. A friend suggested it may have something to do with VPN, that was enabled the whole time. After turning off VPN, the error changed into PublicKeyRetrieval not allowed.

Then I went to connection properties in DBeaver, and then to Driver properties. I set allowPublicKeyRetrieval to true and useSSL to false, and suddenly everything worked.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.