Connecting to a MySQL server docker instance from localhost

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

[[email protected] ~]$ 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:

[[email protected] ~]$ 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?

Answer

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