Continuous Drupal: Can't Connect to MariaDB

I was following this wonderful tutorial to get a docker container up and running but ran into some issues that I can’t seem to resolve.

Following the guide exactly, both of the containers start up, but when I go to the Drupal Installation it returns " Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [2002] Connection refused." If I use docker-compose to enter bash on the database container I can access mysql from the command line, but from the drupal container, it’s inaccessible. Same goes for my Linux Host. I thought this might be because I had a MariaDB server running on my host and they were fighting for the same port so I stopped the one on my host and ran docker-compose again to build both but nothing changed.

What should I do? Thanks ahead of time.

EDIT: I wanted to also point that I have tried logging in like so from my drupal container mysql -h -u root -P 3306 -p and I get a different error ERROR 2003 (HY000): Can't connect to MySQL server on '' (111 "Connection refused"). I thought I might end up chasing down firewall configs for a while before I decided to try the wodby/docker4drupal images ( ). Those worked out perfectly, so this definately isn’t a firewall issue, but rather a networking issue between the containers. Really interested to see what it could be.

I’m having the same issue.

@jaydee18: the best approach is to post your YAML file, and anything else that might be relevant, so that folks can take a look at it. Are you running Docker Compose inside a Docker 2.0 build container?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.