We're Hiring!

Mattermost, Inc.

Installation problems: Failed to ping DB


Cannot connect to the database during installation

Steps to reproduce

I am following instructions from the Installing Mattermost on Ubuntu 18.04 LTS manual. So far I have not received any error messages. I also tried troubleshooting with MySQL Installation Troubleshooting but every time I try to start the database I receive the same error. I have checked an re-checked the config.json file and entered the data exactly as instructed.

I am entering cd /opt/mattermost
sudo -u mattermost ./bin/mattermost

Expected behavior

The server is supposed to start.

Observed behavior

{“level”:“info”,“ts”:1605258928.8680353,“caller”:“utils/i18n.go:90”,“msg”:“Loaded system translations”,“for locale”:“en”,“from locale”:"/opt/mattermost/i18n/en.json"}
{“level”:“info”,“ts”:1605258928.8791585,“caller”:“sqlstore/supplier.go:232”,“msg”:“Pinging SQL”,“database”:“master”}
{“level”:“error”,“ts”:1605258928.8796403,“caller”:“sqlstore/supplier.go:244”,“msg”:“Failed to ping DB”,“error”:“dial tcp connect: connection refused”,“retrying in seconds”:10}
{“level”:“info”,“ts”:1605258938.8797626,“caller”:“sqlstore/supplier.go:232”,“msg”:“Pinging SQL”,“database”:“master”}
{“level”:“error”,“ts”:1605258938.8801558,“caller”:“sqlstore/supplier.go:244”,“msg”:“Failed to ping DB”,“error”:“dial tcp connect: connection refused”,“retrying in seconds”:10}

Any way I have tried to start the server did not work. Restarting it also did not work and leads to the same error message. What am I missing?

Hello @AgileParent, I’m sorry to hear that you’re having issues. Are you connecting to a local database or a remotely hosted database?

I ran a Nmap (network mapper) scan on the IP address you included in your original post (see quote)

and determined that it is not possible for you to connect to a database instance on this address, as the port 3306 (the common MySQL port, and the one that is utilized in this error message) is not open, as you can see in the following scan output, in which the port doesn’t even show up on the results, indicating that the port is completely closed and unable to be accessed from outside the local environment of the server.

Host is up (0.16s latency).
Not shown: 3392 closed ports
22/tcp  open     ssh
25/tcp  filtered smtp
80/tcp  open     http
137/tcp filtered netbios-ns
138/tcp filtered netbios-dgm
139/tcp filtered netbios-ssn
443/tcp open     https
646/tcp filtered ldp

Nmap done: 1 IP address (1 host up) scanned in 30.88 seconds

However, if the database that you are trying to connect to is on the same local server as your Mattermost instance, I suggest changing the IP address to as this is the standard loopback interface for all networked devices–this will tell Mattermost to connect to the local server on port 3306 and therefore connect to the local database.

1 Like

Thank you, this worked.

1 Like

I’m very glad to hear that, your welcome! :slight_smile: