Page 1 of 2

Cannot login to postgresql

Posted: Wed Oct 17, 2012 10:23 pm
by ytlcomm
Hi guys,

It's me again. I've encountered disk full issue in Nagios server and after the issue resolved another issue occured.

It's when we try to repair the Postgresql DB. We seems to have a problem login to Postgres.

Code: Select all

[root@nagios01 ~]# psql postgres postgres
psql: FATAL:  Ident authentication failed for user "postgres"

Code: Select all

[root@nagios01 ~]# psql nagiosxi nagiosxi
psql: FATAL:  Ident authentication failed for user "nagiosxi"
As a result we receive this error when try to login to Nagios WebUI.

Code: Select all

DB Connect Error [nagiosxi]: Database connection failed 
I've walk around the web to find the solution but seems not helping. Need your advice on this.



- Faiz

Re: Cannot login to postgresql

Posted: Thu Oct 18, 2012 1:36 am
by ytlcomm
My pg_ident.conf file is empty. Is this ok?

Code: Select all

# PostgreSQL User Name Maps
# =========================
#
# Refer to the PostgreSQL Administrator's Guide, chapter "Client
# Authentication" for a complete description.  A short synopsis follows.
#
# This file controls PostgreSQL username mapping. It maps
# external user names to their corresponding
# PostgreSQL user names.  Records are of the form:
#
# MAPNAME  SYSTEM-USERNAME  PG-USERNAME
#
# (The uppercase quantities must be replaced by actual values.)
#
# MAPNAME is the (otherwise freely chosen) map name that was used in
# pg_hba.conf.  SYSTEM-USERNAME is the detected user name of the
# client.  PG-USERNAME is the requested PostgreSQL user name.  The
# existence of a record specifies that SYSTEM-USERNAME may connect as
# PG-USERNAME.
#
# If SYSTEM-USERNAME starts with a slash (/), it will be treated as
# a regular expression.  Optionally this can contain a capture (a
# parenthesized subexpression).  The substring matching the capture
# will be substituted for \1 (backslash-one) if present in PG-USERNAME.
#
# Multiple maps may be specified in this file and used by pg_hba.conf.
#
# No map names are defined in the default configuration.  If all system
# user names and PostgreSQL user names are the same, you don't need
# anything in this file.
#
# This file is read on server startup and when the postmaster receives
# a SIGHUP signal.  If you edit the file on a running system, you have
# to SIGHUP the postmaster for the changes to take effect.  You can use
# "pg_ctl reload" to do that.

# Put your actual configuration here
# ----------------------------------

# MAPNAME     SYSTEM-USERNAME    PG-USERNAME

# EOF

Re: Cannot login to postgresql

Posted: Thu Oct 18, 2012 3:42 am
by ytlcomm
I've edited /var/lib/pgsql/data/pg_hba.conf and comment

Code: Select all

#local   all         all    
And add

Code: Select all

local   all     all     trust
Restart postgresql service and run below command.

Code: Select all

[root@nagios01 pgsql]# psql nagiosxi nagiosxi              
psql: FATAL:  database "nagiosxi" does not exist

Re: Cannot login to postgresql

Posted: Thu Oct 18, 2012 4:57 am
by ytlcomm
I've also received similar error in /var/log/messages

Code: Select all

Oct 18 17:55:43 nagios01 nagios: ndomod: Error writing to data sink!  Some output may get lost.  4808 queued items to flush.
Oct 18 17:55:59 nagios01 nagios: ndomod: Successfully reconnected to data sink!  3774 items lost, 5000 queued items to flush.
Oct 18 17:55:59 nagios01 ndo2db: Error: Could not connect to MySQL database: Access denied for user 'ndoutils'@'localhost' (using password: YES)
Please really help.

Re: Cannot login to postgresql

Posted: Thu Oct 18, 2012 10:43 am
by mguthrie
Would you be available for a remote session either today or tomorrow between 9:30am-3:30pm CST? (utc -06:00)

Re: Cannot login to postgresql

Posted: Thu Oct 18, 2012 10:58 pm
by ytlcomm
Oh, I missed your reply. Will send you PM shortly.

Re: Cannot login to postgresql

Posted: Fri Oct 19, 2012 12:38 pm
by mguthrie
Just to follow up, I haven't received any PM's regarding this. Are you following up by email? Let me know if anyone is following up with you on this and if not we'll try and get a session scheduled.

Re: Cannot login to postgresql

Posted: Mon Oct 29, 2012 11:31 am
by ytlcomm
Hi Mike,
Can we got remote support for this? It's been a few days and we need to migrate this server as soon as possible.

Re: Cannot login to postgresql

Posted: Mon Oct 29, 2012 1:39 pm
by mguthrie
Were you able to get the yum issue resolved in order to reinstall postgres? I hadn't heard anything back by email, did my previous email come through?

Re: Cannot login to postgresql

Posted: Tue Oct 30, 2012 2:18 am
by ytlcomm
Yes. Yum is working right now. I've follows your troubleshooting step and postgres is now working. Right now, nagiosxi web UI cannot be opened.

Receive below error in httpd/error_log

Code: Select all

[Tue Oct 30 11:40:49 2012] [error] [client xx.xx.xx.xx] PHP Warning:  mysql_pconnect(): Access denied for user 'nagiosql'@'localhost' (using password: YES) in /usr/local/nagiosxi/html/db/adodb/drivers/adodb-mysql.inc.php on line 383, referer: http://yy.yy.yy.yy/
I guess it's MySQL credentials problem now. Since I'm not that competence using MySQL can we get remote session for this?