patternsqlMinor
Connect MySQL workbench with MySQL container
Viewed 0 times
connectcontainerworkbenchwithmysql
Problem
I pulled MySQL container from Dockerhub and it is running on my macbook pro as you can see as follow
Then I downloaded the MySQL workbench and I tried to connect it with MySQL container, but it does not work. It shows connection error.
The IP from docker machine is
and the port from MySQL is 3306 as you can see above.
To export MySQL port, I tried with the statement
It does not work at all. What am I doing wrong?
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
12cd3deaa3f0 mysql:latest "/entrypoint.sh mysql" 47 hours ago Up 10 minutes 3306/tcp mysqldbThen I downloaded the MySQL workbench and I tried to connect it with MySQL container, but it does not work. It shows connection error.
Your connection attempt failed for user 'root' from your host to server at 192.168.99.102:3306:
Can't connect to MySQL server on '192.168.99.102' (60)The IP from docker machine is
docker-machine ip default
192.168.99.100and the port from MySQL is 3306 as you can see above.
To export MySQL port, I tried with the statement
docker run -d -P mysql:latest mysqldbIt does not work at all. What am I doing wrong?
Solution
It looks like you ran the container without setting the
You should be all set now.
-p 3306:3306 parameter. Also, it seems that you mistyped the IP address in of the Hostname in MySQL Workbench. I recommend starting from scratch by following these instructions:- Run the mysql server. (Change the password
adminto anything you want)
docker run -e MYSQL_ROOT_PASSWORD=admin --name mysql -d -p=3306:3306 mysql- get the IP address of the default docker virtual machine by running
docker-machine ip default- Copy the IP address that you'll get as the result of the previous command. (in your case, it should be 192.168.99.100)
- Open MySQL Workbench and create a new connection. Paste the IP address that you copied into the "Hostname" field.
You should be all set now.
Context
StackExchange Database Administrators Q#122025, answer score: 9
Revisions (0)
No revisions yet.