MySQL in Docker: Access denied for user `root@172.19.0.1` (using password: YES)
I am trying to debug a problem where I cannot track down where the IP address 172.19.0.1 is referenced.
I have a MySQL 8.0 Docker container running on 172.19.0.2 and no other Docker container and when I try to connect via DatagGrip I keep getting the error "Access denied for user `root@172.19.0.1` (using password: YES)" even though I do not have a container at that IP (or at least `docker ps` does
BTW, if I stop Docker for Desktop [Mac] I get "communications link failure" so it seems that somewhere there is something in Docker that response to IP 172.19.0.1. But even so, that's not my MySQL container.
I have tried to specify both 172.19.0.2 and localhost in my datasource, and I have tried many different drivers and tried several StackOverflow answers, but it always comes back to "Access denied for user `root@172.19.0.1` (using password: YES)"
So my main question is:
"Why is DataGrip trying to talk to 172.19.0.1
when I have not specified that?"
(I may have specified 172.19.0.1 somewhere months ago, but if so I have no idea where now.)
Once that's resolved then my questions are:
1. What driver should I be using for MySQL in their official Docker container?
2. Is there any special configuration I need to provide for that driver? And
3. What should my data source config look like?
Thanks in advance.
请先登录再写评论。
Mike Schinkel,
How do you run your container? Could you provide a command?
vasily chernov — I don't use a command, at least not for this container. I run in from within the Docker Desktop GUI.
Make sure you've exposed a port for proper TCP/IP connection: