Database Test connection Issue

I have pulled Invoiceninja image from Docker hub and deployed to my server, its hosted properly but in database connection unable to connect. Database and user-created with default credentials.

issue - SQLSTATE[HY000] [2002] Connection refused

Given details :-
host - localhost
user - ninja
db - ninja
password - ninja

Couple different things could be going on, I’ll start with the easy one.

First, localhost could be failing to resolve for whatever reason. Try pointing to the actual IP address first and see if that does anything. If it does, you should be set.

If you’re still not getting it to work (and you can run SQL queries manually, either through the command line or something like MySQL Workbench), try running SHOW GLOBAL VARIABLES LIKE ‘PORT’; and make sure it returns 3306.