Reputation: 154
I have created a docker instance which also includes mysql in this image, now i want to check whether my mysql is accessible remotely or not ?
How to check whether the connection is established or not?
Upvotes: 1
Views: 1292
Reputation: 1328992
See issue 95: make sure you map the port used by your mysql image to a port of your host (if Linux)
docker run -p 3306:3306 --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:latest
And if you use docker with VirtualBox (Windows or Mac), you would need to port-forward that port to your actual host
VBoxManage controlvm "default" natpf1 "tcp-port3306,tcp,,3306,,3306";
And use docker-machine ip default to get the actual address.
You would not need that if you are using docker for Windows (HyperV) or for Mac (HyperKit).
See "MySQL Docker Containers: Understanding the basics" for more.
Update March 2017, from the same issue 95
aercolino reports in this comment:
I just found out I can connect SequelPro to a MySQL server on Docker with these data: (no need for the IP of the server)
Host: 0.0.0.0
Port: 32768
Username: wordpress
Password: wordpress
I posted my configuration here: How to install WordPress with Docker on OS Sierra
That could work, but 0.0.0.0
is the broadcast address of the zero network or 0.0.0.0
, which in Internet Protocol standards stands for this network, i.e. the local network.. Not always safe to use.
Upvotes: 1