0

I created a MySQL server docker instance using the following command:

[me@centos7 ~]$ docker run --name mysql_db -p 6604:3306 -e MYSQL_ROOT_HOST='%' -e MYSQL_ROOT_PASSWORD='jose' -d mysql/mysql-server:5.7
3d7d2c6231cbc2a8f96d1c965588c4349113c18aa01c8322dc79c670d6d02105

When I try to connect to the server, I get the following error:

[me@centos7 ~]$ mysql -uroot -pjose -h localhost -P6604
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

How should I fix my commands to be able to connect to the server instance using my local MySQL client?

2
  • Can you log in successfully if you exec into the container. Commented Jul 14, 2021 at 8:48
  • @BoristheSpider, yes, i can login using the following command docker exec -it mysql_db bash Commented Jul 14, 2021 at 8:53

1 Answer 1

1

you can read about bind-address

sudo lsof -i -P -n | grep LISTEN
docker-pr 673318            root    4u  IPv4 8564315      0t0  TCP *:6604 (LISTEN)

try

mysql -uroot -pjose   -h 0.0.0.0  -P6604

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.