Re: How to make superuser from non superuser in PostgreSQL

From: Holger Jakobs <holger(at)jakobs(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: How to make superuser from non superuser in PostgreSQL
Date: 2024-09-19 15:50:27
Message-ID: 1D39ED30-ABEB-4F1A-9080-B42539F78AFA@jakobs.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

If the database system is running on a machine you have access to, you might start it in single user mode and establish a new superuser role or change the password.

Directly from SQL this isn't possible as it would make all restrictions useless.

--
Holger Jakobs, Bergisch Gladbach
Tel. +49 178 9759012

Am 19. September 2024 17:06:57 MESZ schrieb "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>:
>On Thursday, September 19, 2024, Sunil Jadhav <sunilbjpatil(at)gmail(dot)com>
>wrote:
>
>>
>> I don't know the superuser password?
>>
>>
>You will need to figure out a way to login as the (an?) existing
>superuser. Typically a password is not required since the pg_hba.conf file
>usually has a “local postgres postgres peer” (or equivalent) entry which
>lets the DBA become the OS postgres (or whatever user owns the service)
>user and then just connect to the cluster using the postgres role.
>Regardless, your ability to becomes superuser depends at this point on
>being able to become the OS user that owns the PostgreSQL service so you
>can modify pg_hba.conf to let you login.
>
>David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Muhammad Usman Khan 2024-09-20 04:18:34 Re: How to make superuser from non superuser in PostgreSQL
Previous Message David G. Johnston 2024-09-19 15:06:57 Re: How to make superuser from non superuser in PostgreSQL