Installing MySQL in Docker fails with error message “Can't connect to local MySQL server through socket”

后端 未结 13 1459
轻奢々
轻奢々 2020-12-13 01:53

I\'m trying to install mysql inside a docker container,Tried various images from github, it seems they all manage to successfully install the mysql but when I try to run the

13条回答
  •  遥遥无期
    2020-12-13 02:20

    If you don't have MySQL installed on your host, you have to execute it in the container (https://docs.docker.com/engine/reference/commandline/exec/#/examples gives explanation about docker run vs docker exec).

    Considering your container is running, you might use docker exec yourcontainername mysql -u root -p to access to the client.

    Also, if you are using Docker Compose, and you've declared a mysql db service named database, you can use : docker-compose exec database mysql -u root -p

提交回复
热议问题