0

I have started Mysql instance in docker by issuing command docker run -d -p 3306:3306 --name some-mysql -e MYSQL_ROOT_PASSWORD=supersecret some-mysql . But when i am trying to login as root by issuing command mysql -u root -p and giving password superscret . I am getting below provided error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
3

1 Answer 1

1

I am assuming that you are executing mysql -u root -p from the host itself not inside the container.

So based on my assumption the container does not have a mysql.sock inside the host itself when you run it, so you need to change the default protocol.

This command will connect through tcp instead of socket

mysql --protocol=tcp -u root -p
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.