Skip to content

ERROR 2005 (HY000): Unknown MySQL server host 'some-mysql' (0) #644

Closed
@pcantalupo

Description

@pcantalupo

I'm trying to follow instructions on this page to run docker mysql

$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql
c365f36e34cd5a580d380f09be3845e84a7a8a741b5a739062d976895d353fb6

$ docker ps | grep some-mysql
c365f36e34cd        mysql               "docker-entrypoint.s…"   27 seconds ago      Up 26 seconds       3306/tcp, 33060/tcp   some-mysql

$ docker inspect bridge | grep -B2 -A5 some-mysql
        "Containers": {
            "c365f36e34cd5a580d380f09be3845e84a7a8a741b5a739062d976895d353fb6": {
                "Name": "some-mysql",
                "EndpointID": "5edbd0af493cad5c8c69525576aab0db8472e7523668104c2b23299053ed9bd6",
                "MacAddress": "02:42:ac:11:00:03",
                "IPv4Address": "172.17.0.3/16",
                "IPv6Address": ""
            },

Then I'm trying to connect to MySQL from the MySQL command line client with your example code where I replaced some_network with bridge since that is the network some-mysql is on. However I get the following error...why?

$ docker run -it --network bridge --rm mysql mysql -hsome-mysql -u root -p
Enter password: 
ERROR 2005 (HY000): Unknown MySQL server host 'some-mysql' (0)

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions