django.db.utils.OperationalError: (2002, Can't connect to MySQL server on 'db' code example
Example: django.db.utils.OperationalError: (2002, “Can't connect to MySQL server on 'db'
# Make sure that your db docker image is running fine. Check the logs of the running db container.
# I am able to use MariaDB successfully in my docker-compose file :
db:
image: mariadb
ports:
- 3306:3306
environment:
MYSQL_USER: "****"
MYSQL_PASSWORD: "****"
MYSQL_DATABASE: "*****"
MYSQL_RANDOM_ROOT_PASSWORD: "yes"