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
Looks like the MySQL account you use in the mautic_web instance has not the required rights to use the database. In MySQL there is an IP ACL additionally to the user/password.
You don’t mention if the database already exists or you like to create a new one? If the later is true then this is wrong
DOCKER_MAUTIC_LOAD_TEST_DATA=false
and needs to be set to
DOCKER_MAUTIC_LOAD_TEST_DATA=true
to create a new database.
Thanks for taking the time to reply. I don’t know what you mean by IP ACL. I changed this value “DOCKER_MAUTIC_LOAD_TEST_DATA=true” according to your instructions but the same issue persists.
You should get a connection prompt of MySQL, like that:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 52563
Server version: 8.0.40 MySQL Community Server - GPL
If you got “access denied” instead, try to use the root user, to connect:
mysql -hdb.farm-mail-docker -uroot -pfmq2108b
If that get’s the same, there is a problem with the database. Try to delete the locally mapped DB files inside /var/lib/mysql/ on your host.
The setting
DOCKER_MAUTIC_LOAD_TEST_DATA=true
will cause this inside entrypoint_mautic_web.sh to be executed:
# prepare mautic with test data
if [ "$DOCKER_MAUTIC_LOAD_TEST_DATA" = "true" ]; then
su -s /bin/bash www-data -c 'php /var/www/html/bin/console doctrine:migrations:sync-metadata-storage'
# mautic installation with dummy password and email, as the next step (doctrine:fixtures:load) will overwrite those
su -s /bin/bash www-data -c 'php /var/www/html/bin/console mautic:install --force --admin_email willchange@mautic.org --admin_password willchange http://localhost'
su -s /bin/bash www-data -c 'php /var/www/html/bin/console doctrine:fixtures:load -n'
fi
which will install a basic database structure if none exists. But as you can see, the database is persistet on the host running the docker containers and so you need to “docker compose down”, delete the local DB files and “docker compose up -d” again, to have it recreated.
to ensure a proper startup. If it starts correctly i assume something is wrong with the setup of the database, because of the access denied.
According to your docker-compose.yml file the MySQL database files are stored in an “named volume” called “mysql-data”. This volume will persist, and so it’s data, even if you rebuild the containers. You should remove that volume before rebuilding. Try to start from scratch (delete ALL data):
After running those commands. This is the error I get
/mysqld/mysqld.sock' exists!
farm-mail_mautic_web_1 | mysqladmin: connect to server at '' failed
farm-mail_mautic_web_1 | error: 'Can't connect to server on 'localhost' (111)'
farm-mail_mautic_web_1 | Check that mariadbd is running and that the socket: '/run/mysqld/mysqld.sock' exists!
I decided to start from scratch with the original docker-compose file to make sure there weren’t any changes I made to it that screwed things up. However, now I’m back to the same error smh. I deleted and pruned everything before I re-installed.
mautic_web-1 | mysqladmin: connect to server at 'db.farm-mail-docker' failed
mautic_web-1 | error: 'Host '172.18.0.3' is not allowed to connect to this MySQL server'
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1337c894fede nginx "/docker-entrypoint.…" 4 hours ago Up 4 hours 0.0.0.0:8002->80/tcp, [::]:8002->80/tcp farm-mail-nginx-1
ae32457b6411 mautic/mautic:5-fpm "/entrypoint.sh php-…" 4 hours ago Up 4 hours (unhealthy) 9000/tcp farm-mail-mautic_web-1
9c74d3761eaa mysql:8.0 "docker-entrypoint.s…" 4 hours ago Up 4 hours (healthy) 3306/tcp, 33060/tcp farm-mail-db-1
docker logs mautic_web
mysqladmin: connect to server at 'db.farm-mail-docker' failed
error: 'Host '172.18.0.3' is not allowed to connect to this MySQL server'
mysqladmin: connect to server at 'db.farm-mail-docker' failed
error: 'Host '172.18.0.3' is not allowed to connect to this MySQL server'
Can’t login to mysql
oot@ae32457b6411:/var/www/html/docroot# mysql -hdb.farm-mail-docker -u root -p fmq2108b
Enter password:
ERROR 1130 (HY000): Host '172.18.0.3' is not allowed to connect to this MySQL server
root@ae32457b6411:/var/www/html/docroot# mysql
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)