I'm setting up HortusFox with Docker Compose using separate web-app and MariaDB services. The database and root passwords are stored in an .env file, but the app remains stuck on "Waiting for database to be available," while MariaDB reports: "Access denied for user 'user'@'172.26.0.3' (using password: YES). What should I check to resolve the authentication failure?
3 Answers
This is most likely a configuration mismatch rather than a Docker networking issue. Check every place where the database username and password are defined and make sure the app’s connection settings, the MariaDB environment variables, and the .env file all use exactly the same values. In this case, the password had been defined twice with different values, which caused the login failure.
Review the MariaDB service environment block and confirm it actually references the variables from your .env file rather than still using example values such as `my-secret-pw` or `password`. Also verify that the database username configured for the app matches `MARIADB_USER`. Logging into the database container and checking the existing users and grants can help confirm what credentials are active.
I checked the database container and confirmed that both the application user and root account existed and could authenticate. The real issue was still the duplicated password setting in the Compose file.
One other thing to remember with MariaDB containers is that the initialization variables are generally applied only when the data directory is created. If you change credentials after a persistent volume has already been initialized, restarting the container may not update the existing account. In that situation, recreate the database volume only if you’re sure there’s no data to preserve, or change the user password directly inside MariaDB.

That was exactly the problem. I had accidentally assigned different passwords in two parts of the Compose configuration. Once they matched, the connection worked.