How to execute MySQL command from the host to container running MySQL server?

前端 未结 9 1826
春和景丽
春和景丽 2021-01-30 06:31

I have followed the instruction in https://registry.hub.docker.com/_/mysql/ to pull an image and running a container in which it runs a MySQL server.

The container is run

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-30 07:18

    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.

提交回复
热议问题