Mazzy Mazzy - 1 year ago 100
MySQL Question

Execute mysql command from the host to container running mysql server

I have followed the instruction to pull an image and running a container in which it runs a mysql server. The container is running in the background and I would run some commands. Which is the best way to connect to the container and execute this command from command line?

Answer Source

You can connect to your mysql container and run your commands using:

docker exec -it mysql bash -l

(Where mysql is the name you gave the container)

Keep in mind that anything you do will not persist to the next time your run a container from the same image.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download