0

I am using windows 8. My Postgres was Correct. I just took the data directory from C:/postgresql/8.3/ Now database was connected through command prompt. When I was trying to connect using pgadmin, it's saying

FATEL: error
An error has occured:
Error connecting to sthe server: FATAL: role "postgres" is not permitted to log in

I changed the required things in pg_hba.conf (trust) and postgresql.conf (connection *) (port 5433)

But, still I was unable to connect the database.

How to give the permissions to postgres role. when am trying to give the permissions through cmd also it's giving same error.

I was tried in so many ways but, still I didn't get the database.

5
  • Are you using the PostgreSQL 8.3 version because you cannot take a data directory from different version from the one you're currently using. Is it an imported data directory or fresh install - has there been any changes to the database login roles? "Now database was connected through command prompt" - do you mean you can connect to the database via psql? Commented Mar 21, 2015 at 18:22
  • Question seems like it would be more suitable for serverfault Commented Mar 21, 2015 at 19:06
  • Yes the data directly and currently installed postgres versions both are same (8.3) and I didn't connected to database through psql........ I just enable the database using cmd......... like if We have data directory in C:/postgres/8.3/sample/data then we can enable database which is available in data directory with the help of cmd,the command is C:/***/8.3/bin>postgres.exe -D <data dir path> -p5433 5433 is changed port .that have to be changed in data directory postgresql.conf file Commented Mar 22, 2015 at 5:34
  • then it will create .pid file in data directory now we can conform that the database was enabled successfully then we can connect to that port through psql or pgadmin III When I tried to connect the database in this way using current (fresh Installed data) data directory it's successfully connected. but when i was trying to connect old data (currepted database data dir) directory it's saying role postgres is not permitted to log in What should i do? please give me suggessions Commented Mar 22, 2015 at 5:35
  • Or else I just replace the Old data directory in fresh installed postgres/8.3 folder Then also it's giving same error Just help me to connect my database versions are same and modify hba-conf(trust) and postgresql.conf file also Thanks in advance Commented Mar 22, 2015 at 5:53

1 Answer 1

0

It looks like you might have accidentally revoked the LOGIN and SUPERUSER rights from the postgres user. Perhaps you created a superuser with a different name instead? Log in as that user if you did.

If not, and you can't get access as user postgres, you will need to start the database engine up in single-user mode and manually GRANT the SUPERUSER right to postgres again. This is much the same process as is required when recovering from a dropped (deleted) superuser account.

See related:

BTW, 8.3 is a very old and unsupported version. Plan your upgrade promptly.

If there's no data in PostgreSQL that you care about, the easiest thing to do will be:

  • Uninstall PostgreSQL 8.3;
  • Delete C:\Program Files\PostgreSQL\8.3 (permanently and unrecoverably destroying all data in your PostgreSQL databases); and
  • Install a current PostgreSQL version
Sign up to request clarification or add additional context in comments.

Comments

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.