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

后端 未结 13 1452
轻奢々
轻奢々 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:14

    Specifying the host as 0.0.0.0 did work for me.

    I created docker container using below command

    docker run --detach --name=mysql --env="MYSQL_ROOT_PASSWORD=root" --publish 3306:3306 mysql
    

    Then installed mysql client

    sudo apt-get install mysql-client
    

    Connected to mysql via terminal using below command

    mysql --host 0.0.0.0 --port 3306 -proot -u root
    

提交回复
热议问题