-1

I was learning permission related stuffs in postgres11. Using Pgadmin, i changed postgres login roles privileges from superuser to non-superuser as below

enter image description here

Now i am trying to make it as superuser but i am not able to do as i am now a non-super user.

I know i should not have done to that to postgres. i should have created another superuser and have played on that login.

Is there any way to do it or do i need to install again.

Thanks in Advancef

Allan Wind
  • 23,068
  • 5
  • 28
  • 38
VBAGuy
  • 172
  • 1
  • 9

1 Answers1

0

If you have another user with the superuser option, you can modify pg_hba.conf to allow login as one of the other superusers, then you can login as one of those and then alter role postgres superuser.

Otherwise stop the PostgreSQL server, then restart it in single user mode, where it's always running as superuser. Then ALTER USER postgres SUPERUSER to grant superuser rights. Exit single user mode, and start the server back up. I don't use Windows but here is a question that covers that: How can I start PostgreSQL on Windows?. It looks like https://dba.stackexchange.com/questions/130497/restore-superuser-role-to-postgres-user would be helpful to you.

Allan Wind
  • 23,068
  • 5
  • 28
  • 38
  • @Allan...Thanks for the response. But i am using Windows. Could you please give me the steps to do. meanwhile i am trying from myside. – VBAGuy Mar 25 '21 at 15:03