Unable to ping database during installation - Solved

I’m doing a new installation on a RHEL 7.4 server, I’ve had to manually install postgres-9.2.24 because of company procedures and when I’m testing whether the mattermost server works properly, I get the error that it is unable to ping the db :

{“level”:“info”,“ts”:1553271398.8555436,“caller”:“utils/i18n.go:83”,“msg”:“Loaded system translations for ‘en’ from ‘/opt/mattermost/i18n/en.json’”}
{“level”:“info”,“ts”:1553271398.8557446,“caller”:“app/server_app_adapters.go:58”,“msg”:“Server is initial izing…”}
{“level”:“info”,“ts”:1553271398.8631089,“caller”:“sqlstore/supplier.go:215”,“msg”:“Pinging SQL master dat abase”}
{“level”:“error”,“ts”:1553271398.8687565,“caller”:“sqlstore/supplier.go:227”,“msg”:“Failed to ping DB ret rying in 10 seconds err=pq: Ident authentication failed for user “mmuser””}

Now, I’ve checked whether I can connect to the db with psql and I can, but it completely disregards the password I’ve created for mmuser. I can connect to it by typing anything when it prompts me for the pw… I’ve followed every step and modified the json config file and everything.

Thanks for your help.

Hi @shea_bb9,

A response from a community member:

What’s your Mattermost server version? What’s your DataSource configuration value? How did you figure out that Mattermost " completely disregards the password [you]'ve created "?

I’ve installed version 5.9 and the DataSource configuration is this one for postgres :
“DriverName”: “postgres”,
“DataSource”: “postgres://mmuser:innovation123@127.0.0.1:5432/mattermost?sslmode=disable&connect_timeout=10”,

As I said in the post, I’ve tried to connect to the db with psql and typed the wrong password and could still access the mattermost db even when I typed random things instead of the password.

I have the same problem.
When I directly connect to my postgesql with the user mmuser, it’s OK.
I control the configuration, and it don’t work and I have the same message when I launch sudo -u mattermost ./bin/mattermost.
I check all step of install process, and all is OK.
Mattermost is installed on RHEL 7.4 server and postgres-9.4
Can you help me please ?

Hi there, @Egyptien91

Since you mentioned that the command does not work:

sudo -u mattermost ./bin/mattermost
  • What do you actually mean by it does not work? Can you please share the error that you are getting from the terminal / command line?
  • Did you ensure that you ran it while you are in the right directory /opt/mattermost ? For example:
ahmaddanial@mattermost:/opt/mattermost$ sudo -u mattermost ./bin/mattermost
2019-12-02T05:12:26.451Z	info	utils/i18n.go:83	Loaded system translations	{"for locale": "en", "from locale": "/opt/mattermost/i18n/en.json"}
2019-12-02T05:12:26.455Z	info	app/server_app_adapters.go:59	Server is initializing...
2019-12-02T05:12:26.460Z	debug	utils/html.go:30	Parsing server templates	{"templates_directory": "/opt/mattermost/templates"}
2019-12-02T05:12:26.472Z	info	sqlstore/supplier.go:222	Pinging SQL	{"database": "master"}
2019-12-02T05:12:26.576Z	debug	sqlstore/preference_store.go:41	Deleting any unused pre-release features
2019-12-02T05:12:26.580Z	debug	filesstore/localstore.go:33	Able to write files to local storage.
2019-12-02T05:12:26.583Z	info	app/license.go:46	License key valid unlocking enterprise features.
2019-12-02T05:12:26.587Z	info	mlog/log.go:166	Starting up plugins
2019-12-02T05:12:26.588Z	info	app/plugin.go:199	Syncing plugins from the file store
2019-12-02T05:12:26.589Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "antivirus"}
2019-12-02T05:12:26.591Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "com.github.manland.mattermost-plugin-gitlab"}
2019-12-02T05:12:26.594Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "com.mattermost.aws-sns"}
2019-12-02T05:12:26.595Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "com.mattermost.custom-attributes"}
2019-12-02T05:12:26.597Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "com.mattermost.nps"}
2019-12-02T05:12:26.601Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "com.mattermost.welcomebot"}
2019-12-02T05:12:26.604Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "github"}
2019-12-02T05:12:26.606Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "jenkins"}
2019-12-02T05:12:26.608Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "jira"}
2019-12-02T05:12:26.611Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "mattermost-autolink"}
2019-12-02T05:12:26.613Z	debug	app/plugin.go:221	Removing local installation of managed plugin before sync	{"plugin_id": "zoom"}
2019-12-02T05:12:26.615Z	info	app/plugin.go:234	Found no files in plugins file store
  • Does the user mattermost have the permission to execute the command? You should be able to check it using the command below as an example:
ahmaddanial@mattermost:~$ ls -lAh /opt/mattermost/bin/
total 53M
-rwxrwxr-x 1 mattermost mattermost  51M Nov 16 01:06 mattermost
-rwxrwxr-x 1 mattermost mattermost 2.1M Nov 16 01:06 platform

Thank you for your response.
I find the problem this night : in the file pg_hba.conf, I change the line with the word trust :
host all 127.0.0.1/32 trust .
I had always change the first line (local all all trust) with trust, but when I change the line with 127.0.0.1, it’s work.

1 Like

Awesome. Thanks for sharing your fix, @Egyptien91 !