Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

Using the correct postgres server

$
0
0

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

after switching with su postgres and I get this error:

FATAL:  database files are incompatible with server
DETAIL:  The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 8.4.13.

This used to work where it would just give me a warning saying that the db version was 8.4 and server version was 9.2 so some features might not work.


Viewing all articles
Browse latest Browse all 1138

Trending Articles