0

I tried to install a MySQL cluster with the Docker image below.

mysql/mysql-cluster - Docker Image | Docker Hub

The Docker image is pulled and run successfully.

Despite that I could connect to the cluster in the terminal (as shown in the screen capture below), I don't know how to connect to it with MySQL Workbench or DBeaver.

enter image description here

Long Nguyen
  • 179
  • 1
  • 6

2 Answers2

0

In your docker run command, you can use -p 3306:3306 (or any available port). Then you can use <host>:<port> from Workbench or Dbeaver connection URL.

Sounak Saha
  • 852
  • 1
  • 9
  • 21
  • As you replied, I deleted all the existing containers and created them again. The port below was specified during creation. `docker run -d --net=cluster --name=mysql1 --ip=192.168.0.10 -e MYSQL_ROOT_PASSWORD='tpffnrtm1!' -p 3306:3306 mysql/mysql-cluster mysqld` But in dbeaver I get an error as below. ▶ 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. connect timed out. –  Jan 14 '22 at 00:56
  • Are able to access your :3305 through telnet/ nc ? – Sounak Saha Jan 15 '22 at 17:39
0

I assume that you already know how to add new DB connection to MySQL Workbench or DBeaver. The information that you want is the connection URL and the username/password of an authenticated user that you need to use to connect to your MySQL cluster.

For the connection URL: 192.168.0.10 (no port in your example)

You need to have your MySQL Workbench or DBeaver connect to the URL of the MySQL node, which is mysql1 node in your example. As shown in your screen capture, it is 192.168.0.10 without any explicit port. But if you have troubles with the URL, you can run docker ps to check what host and port that your mysql1 is running and exposed at.

For the username/password: root/tpffnrtm1 (the password is the value of MYSQL_ROOT_PASSWORD as shown in your docker run of MySQL node command)

I assume that you just want to connect the DB cluster by any means (root or non-root privileges is totally fine for you).

Long Nguyen
  • 179
  • 1
  • 6
  • As you replied, I deleted all the existing containers and created them again. The port below was specified during creation. `docker run -d --net=cluster --name=mysql1 --ip=192.168.0.10 -e MYSQL_ROOT_PASSWORD='tpffnrtm1!' -p 3306:3306 mysql/mysql-cluster mysqld` But in dbeaver I get an error as below. ▶ 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. connect timed out. –  Jan 14 '22 at 00:54
  • Can you send me the info (connection string, driver, uname/password) that you used when trying to connect with dbeaver? – Long Nguyen Jan 14 '22 at 01:24