Failed to ping DB error, while installing

Hello, I am having trouble while installing mattermost on Ubuntu 18.04. I followed the document https://docs.mattermost.com/install/install-ubuntu-1804.html . When testing the server by: “sudo -u mattermost ./bin/mattermost” I am encountered with an issue as shown below:

{“level”:“error”,“ts”:1583319892.0336497,“caller”:“sqlstore/supplier.go:233”,“msg”:“Failed to ping DB”,“error”:“dial tcp 192.168.1.15:3306: connect: connection refused”,“retrying in seconds”:10}

The configuration which I have in /opt/mattermost/config/config.json is:
“DataSource”: “mmuser:mypassword@tcp(192.168.1.15:3306)/mattermost?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s”,

Does anyone have any suggestions?

Hi there, @neelteja.

It seems that your Mattermost instance is unable to reach out to the database server that you have configured in your config.json. May I know if the database server is hosted within the same machine or on a different one? Do you happen to have any firewall blocking the Mattermost server from communicating with the database instance?

The easiest way to know if the servers can communicate with each other is to run the following command from your Mattermost instance backend:

echo | telnet 192.168.1.15 3306

By default, you should be able to get the following result as an example:

vagrant@mattermost:~$ echo | telnet 192.168.1.15 3306
Trying 192.168.1.15...
Connected to 192.168.1.15.
Escape character is '^]'.
Connection closed by foreign host.

Can you please share the outcome of the test? Thanks.