Connect to Docker MySQL container from localhost?

前端 未结 7 2294
孤街浪徒
孤街浪徒 2020-11-29 23:24

I have a docker mysql image running, following is what the docker-compose.yml file looks like:

db:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: \"\         


        
7条回答
  •  死守一世寂寞
    2020-11-30 00:07

    Connect to MySQL via {host ip}:3306 since you've exposed the internal port to your host as 3306. If you need to access the MySQL CLI tools you will need to go docker exec -it mycontainer bash this will place you inside the container to access the tools installed with MySQL if you do not have them installed locally on the host o/s.

提交回复
热议问题