1

I have more than 20 databases in my PostgreSQL 8.4 server. Someone did something wrong to my Postgres and it is not opening anymore. It gives the following error:

error connecting to the server fatal role postgres is not permitted to log in

I did lot to recover it but it still not working. I have PostgreSQL server 8.4 in windows XP.

pg_hba.conf file configuration is:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# IPv4 local connections:
#local   all   postgres                         ident sameuser
host    all         all         127.0.0.1/32          trust
#host    all         postgres trust 
#host    all         all         192.168.44.12/32      trust
#host    all         all         192.168.44.103/32     trust
# IPv6 local connections:
#host    all         all         192.168.44.18/32      trust
# host   all     all     ::1/128     md5

I suspect that the problem is here because someone modified the ROLE of Postgres user in NOT LOG IN...

6
  • is the database on the same machine you are connecting from? Commented Mar 2, 2013 at 4:40
  • yes database is in the same machine i connecting... Commented Mar 2, 2013 at 4:43
  • did you create any other users than the default postgres user? Commented Mar 2, 2013 at 4:48
  • yes i created but i didn't remember the username. Commented Mar 2, 2013 at 4:52
  • your pg_hba.conf allows all users to connect; do you have a createuser.exe program hanging around with your Postgres binaries? Commented Mar 2, 2013 at 5:03

1 Answer 1

4

Possibly try single user mode. Stop postgres, then run it from the command line:

postgres --single -D path/to/your/postgres/directory

Then:

ALTER ROLE postgres WITH LOGIN

Use Ctrl-D to terminate the session.

That should allow the postgres user to log into the server once again.

Sign up to request clarification or add additional context in comments.

5 Comments

Same error is coming postgres is not permited to log in while creating new user through createuser.exe
Added single user mode comment.
I got an error Postgres is not recognized as the internal or external command, operable program or batch file
the command i given in the cmd is that.. postgres --single -D C:\Program Files\PostgreSQL\8.4\bin\postgres.exe
Thanks lot @ cfeduke my problem is solved........... may god bless you always.....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.