[SOLVED] Trouble during instalation, failed to ping DB

Hello, I’m having some trouble setting up a Mattermost server and I hope someone may be able to lend me a hand with it.

I get stuck in the part where i have to test the server to make sure everything works.

I get the error message -->"Failed to ping DB retrying in 10 seconds err=time: invalid duration
I have uploaded the rest of the logs here–> https://pastebin.com/3JZyVkaH

I’m following the documentation referring to a ubuntu 16.04 installation here --> https:/./docs.mattermost.com/install/install-ubuntu-1604.html and to be more specific I fail at the 8 step of the Mattermost server installation when I input the command --> sudo -u mattermost ./bin/mattermost

I have seen that some people have similiar problems and they are generally due to a bad configuration of the config file in --> /opt/mattermost/config/config.json

This is the configuration that I have right now:
“DataSource”:“mattermostuser:new_password_here@tcp(127.0.0.1:3306)/mattermost?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=$”,

I have tried switching the 127.0.0.1 for “localhost” and for the ip of the computer (172.16.199.55). The password is “new_password_here”

You can find the full file here -->https://pastebin.com/Huv6QiCT

I have also tried following the instructions and changing to mariadb as shown in this post here --> https:/./websiteforstudents.com/install-mattermost-server-version-on-ubuntu-16-04-17-10-18-04/ and making the changes to follow the instructions in both mariadb and mysql, getting the same error message every time.

Right now the server has been installed on an ubuntu 18.04 desktop (I don’t know if the fact that it’s installed on a desktop may be the root of the problem) but I’ve ran into the same problem installing it on an ubuntu 16.04

I have checked and the firewall is disabled.

Versions:
OS: Ubuntu 18.04 desktop
Mysql: Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper
Mattermost: mattermost 5.1.0

Anyone has any suggestions?

Pd: sorry about the links, but new users are only allowed to use 2 hyperlinks on each post at most so i’m forced to break the links to the web pages.

Edit: I have tried installing it in an ubuntu server 18.04 and I get the same error message that I did in the beginning

Here are a few things to check:

  1. Verify that the mysql command can connect to the database using the credentials provided. To do that, run this command on the server
$ mysql -u mattermostuser -p

Then enter the password from your Mattermost config file. If it’s able to connect then you need to verify that user has access to the database. To do that, run these commands:

mysql> USE DATABASE mattermost;
mysql> SELECT * FROM Posts;

That will verify that your authentication is correct. If you see any errors, post them here and I can help you further.

I have run the commands as you told me and I get this output:
mstsc_2018-07-26_09-39-42

Edit: I did a show tables inside mysql and it told me that I didn’t have a single thing inside, so if I’m not wrong the part of the program that was supposed to create the tables, failed miserably. How can I fix it?mstsc_2018-07-26_16-03-56

@pruiz Update: I will ping our devs to take a look at this.

1 Like

Looks like your writeTimeout is incorrect (hence the err=time: invalid duration $). The default value will

mattermostuser:new_password_here@tcp(127.0.0.1:3306)/mattermost_test?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s

Can you give that a try and see what happens?

Sorry, that didn’t work. I get the same error message as I did before

Hey @pruiz! If you are getting exactly the same err=time: invalid duration $ error message, I don’t think your config.json changes have taken effect. If you’re getting a different error, can you post it here?

Ok, my mistake I forgot to change the database, now it’s fixed. Thank you very much for the help!

Hi @jesse I am encountering with the below error at the same step

{“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”,

I also tried to replace the ip address with localhost but it isn’t working.

Could you help me with this error?

Welcome, @neelteja! The short answer is that Mattermost can’t reach your MySQL instance at 192.168.1.15. Without knowing more about your setup, it’s hard to give much insight here.

I might suggest asking in https://community.mattermost.com/core/channels/peer-to-peer-help to see if someone can help you debug further.