I have a mysql container like this :
I want to open the mysql using mysql workbench, does anyone know how ??
I am still confused how to fill this data ..
I hope there is a solution to my problem
tl;dr
You have to publish MySQL's port 3306
to the "outside" using the -p
switch.
Container ports are not accessible by default to the "outside" and are only open to other containers in the same network.
Run your MySQL image with -p 15000:3306
(map local port 15000 to container's port 3306) then connect in the Workbench to localhost
at port 15000
. You can choose any port you want, it can be 3306 too: -p 3306:3306
.
Example docker run
command:
docker run -it --rm -v mysql:/var/lib/mysql -p 3306:3306 mysql
In case of docker-compose
:
services:
# …
mysql:
# …
ports:
- 3306:3306