docker container Mysql Port outside access issue

  docker, mysql, ubuntu

I’ve a mysql inside docker container, which is running on the server.
And I can run it normally inside the container
using

mysql -u root -h localhost --port=3306 -p

I’ve mapped the container 3306 to host 33069 port.

netstat -tnlp | grep :33069

the above command runed on the server shows me the following result

tcp6       0      0 :::33069                :::*                    LISTEN      120562/docker-proxy

from which it’s clear that mysql is available not only for localhost.
However when I try to connect to the mysql from my local machine using the command

mysql -u root -h myAddress.com --port=33069 -p

I get the error
Can't connect to MySQL server on ...
after timeout.
What I’ve missed?

Source: Docker Questions

LEAVE A COMMENT