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

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?


you can read about bind-address

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


mysql -uroot -pjose   -h  -P6604