I have a docker mysql image running, following is what the docker-compose.yml file looks like:
db:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: ""
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- "3306:3306"
This works fine.
My question is: How can I connect to the MySQL instance running on that container from the command line mysql client on my the host (my macbook)?
To clarify:
- I have a macbook with Docker installed
- I have a docker container with mysql
- I want to connect to the mysql instance running on the aforementioned container from the Terminal on my macbook
- I do NOT want to user a
docker
command to make this possible. Rather, I want to use themysql
client directly from the Terminal (without tunneling in through a docker container).
I don't have MySQL running locally, so port 3306 should be open and ready to use.
The command I am using to start the container is: docker-compose run
boot2docker
The docker toolbox was unreliable. I have open issues on their github, and if/when it becomes more stable I'll use it, but for nowboot2docker
is managing the VMs, and it's working fine. – Caleb