Connect to Docker MySQL container from localhost?

前端 未结 7 2287
孤街浪徒
孤街浪徒 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:23

    A simple way to login to MySQL inside a Docker image is:

    sudo docker exec -it <CONTAINER_ID> mysql -u root -p

    for mySQL's root account by default password is not set, its BLANK, just press enter/return key, unless you have changed root password.

    On successful execution, above command gives you mysql prompt.

    Cheers!

    0 讨论(0)
提交回复
热议问题