I am having some issues connecting to the mysql docker container that I have launched with docker-compose. This is a long post (sorry!).
Here is my docker-compose.ym
I am using the official mysql image with docker-compose and not having a problem. The only difference in my compose file is that I am using a dictionary instead of an array:
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_USER: django
MYSQL_PASSWORD: secret
MYSQL_DATABASE: myAppDB
I have noticed that the compose file documentation is still stuck in V1 in some places, so you could try this, if you're using V2. Otherwise, for debugging you can use docker-compose exec
to interact with the container created by compose directly.
docker-compose exec db /bin/bash
will get you a shell on the container that is giving you trouble and you can check things like SHOW GRANTS FOR django@'%'
or whether the ports are being forwarded correctly. I hope this helps.