Your software
My Mautic version is: 5
My PHP version is: 8
My Database type and version is: MYSQL
Your problem
My problem is: Docker installation can’t connect to MYSQL
These errors are showing in the log:
mautic_web-1 | mysqladmin: connect to server at ‘db.farm-mail-docker’ failed
mautic_web-1 | error: ‘Host ‘172.19.0.3’ is not allowed to connect to this MySQL server’
mautic_web-1 | mysqladmin: connect to server at ‘db.farm-mail-docker’ failed
mautic_web-1 | error: ‘Host ‘172.19.0.3’ is not allowed to connect to this MySQL server’
mautic_web-1 | mysqladmin: connect to server at ‘db.farm-mail-docker’ failed
mautic_web-1 | error: ‘Host ‘172.19.0.3’ is not allowed to connect to this MySQL server’
mautic_web-1 | mysqladmin: connect to server at ‘db.farm-mail-docker’ failed
mautic_web-1 | error: ‘Host ‘172.19.0.3’ is not allowed to connect to this MySQL server’
mautic_web-1 | mysqladmin: connect to server at ‘db.farm-mail-docker’ failed
mautic_web-1 | error: ‘Host ‘172.19.0.3’ is not allowed to connect to this MySQL server’
Steps I have tried to fix the problem:
-reviewed config and made sure all the env variables were set
-reviewed old posts for solutions
-reviewed github issues for solutions
My config:
**docker-compose.yml**
x-mautic-volumes:
&mautic-volumes
- ./config:/var/www/html/config:z
- ./logs:/var/www/html/var/logs:z
- ./media/files:/var/www/html/docroot/media/files:z
- ./media/images:/var/www/html/docroot/media/images:z
- ./cron:/opt/mautic/cron:z
- mautic-docroot:/var/www/html/docroot:z
services:
db:
image: mysql:8.0
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping
start_period: 5s
interval: 5s
timeout: 5s
retries: 10
networks:
- default
nginx:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- mautic-docroot:/var/www/html/docroot:z
depends_on:
- mautic_web
ports:
- 8002:80
networks:
- default
mautic_web:
image: mautic/mautic:5-fpm
links:
- db:mysql
volumes: *mautic-volumes
environment:
- DOCKER_MAUTIC_LOAD_TEST_DATA=${DOCKER_MAUTIC_LOAD_TEST_DATA}
- DOCKER_MAUTIC_RUN_MIGRATIONS=${DOCKER_MAUTIC_RUN_MIGRATIONS}
env_file:
- .mautic_env
healthcheck:
test: cgi-fcgi -bind -connect 192.168.1.125:9000
start_period: 5s
interval: 5s
timeout: 5s
retries: 100
depends_on:
db:
condition: service_healthy
networks:
- default
mautic_cron:
image: mautic/mautic:5-fpm
links:
- db:mysql
volumes: *mautic-volumes
environment:
- DOCKER_MAUTIC_ROLE=mautic_cron
env_file:
- .mautic_env
depends_on:
mautic_web:
condition: service_healthy
networks:
- default
mautic_worker:
image: mautic/mautic:5-fpm
links:
- db:mysql
volumes: *mautic-volumes
environment:
- DOCKER_MAUTIC_ROLE=mautic_worker
env_file:
- .mautic_env
depends_on:
mautic_web:
condition: service_healthy
networks:
- default
volumes:
mysql-data:
mautic-docroot:
networks:
default:
name: ${COMPOSE_PROJECT_NAME}-docker
**.env**
COMPOSE_PROJECT_NAME=farm-mail
COMPOSE_NETWORK=${COMPOSE_PROJECT_NAME}-docker
MYSQL_HOST=db.${COMPOSE_NETWORK}
MYSQL_PORT=3306
MYSQL_DATABASE=mautic_db
MYSQL_USER=evon
MYSQL_PASSWORD=fmq2108b
MYSQL_ROOT_PASSWORD=fmq2108b
DOCKER_MAUTIC_RUN_MIGRATIONS=false
DOCKER_MAUTIC_LOAD_TEST_DATA=false
**.mautic_env**
COMPOSE_PROJECT_NAME=farm-mail
COMPOSE_NETWORK=${COMPOSE_PROJECT_NAME}-docker
MYSQL_HOST=db.${COMPOSE_NETWORK}
MYSQL_PORT=3306
MYSQL_DATABASE=mautic_db
MYSQL_USER=evon
MYSQL_PASSWORD=fmq2108b
MYSQL_ROOT_PASSWORD=fmq2108b
DOCKER_MAUTIC_RUN_MIGRATIONS=false
DOCKER_MAUTIC_LOAD_TEST_DATA=false
root@mail-list-server:~/mautic# cat .mautic_env
# use this file for environment variables that can be used.
# see https://docs.mautic.org/en/5.x/
MAUTIC_DB_HOST="${MYSQL_HOST}"
MAUTIC_DB_PORT="${MYSQL_PORT}"
MAUTIC_DB_DATABASE="${MYSQL_DATABASE}"
MAUTIC_DB_USER="${MYSQL_USER}"
MAUTIC_DB_PASSWORD="${MYSQL_PASSWORD}"
MAUTIC_MESSENGER_DSN_EMAIL="doctrine://default"
MAUTIC_MESSENGER_DSN_HIT="doctrine://default"