Skip to main content
1 of 2

Using the correct postgres server

I'm not sure what happened but I logged in on friday and did psql -d name to access a db that was perfectly running just fine. Then I log in this monday morning and try to access the same database with psql -d dbname and this is what I got:

psql: FATAL:  no pg_hba.conf entry for host "[local]", user "johndoe", database "db", SSL off

I try sudo su postgres then I got this:

psql: FATAL:  password authentication failed for user "postgres"

After running

 sudo find / -name pg_hba.conf 

I get:

/var/lib/pgsql/data/pg_hba.conf
/var/lib/pgsql/9.2/data/pg_hba.conf

Modifying the 1st pg_hba.conf and allowing access to postgres allowed me to login through psql. With a \l command there showed no databases or users. This confirms my suspicion that the postgres install I did last Friday did not update the old version I had but installed a new copy of it onto the server.

IS there anyway of logging into the old postgres server or retrieving those databases? I know for a fact they did not get wiped with the new install of postgres as there are two pga_hba.conf files on the box.

If it did get wiped, is there any way of restoring my Centos 6.5 server to a past date?

EDIT:

Afer stopping the new running server with:

service postgres stop

I type postgres into the terminal and I get:

postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.

So I point to the correct server config with:

postgres -D /var/lib/pgsql/9.2/data

and I get a permission denied so I try with root and I get this :( :

"root" execution of the PostgreSQL server is not permitted.