Re: How to make superuser from non superuser in PostgreSQL

Поиск
Список
Период
Сортировка
От Muhammad Usman Khan
Тема Re: How to make superuser from non superuser in PostgreSQL
Дата
Msg-id CAPnRvGs3f7zck7YM+efXgW0G9TrgxybouKf7XJzwkadQ7QrgDg@mail.gmail.com
обсуждение исходный текст
Ответ на How to make superuser from non superuser in PostgreSQL  (Sunil Jadhav <sunilbjpatil@gmail.com>)
Список pgsql-admin
Hi,
You can try the following options
  • Edit pg_hba.conf file and change authentication method to trust
    Reload postgres iand login without password
    psql -U postgres
    And then you can use alter command
    ALTER USER your_username WITH SUPERUSER; 
  • If you have root access to the server than you can directly switch to postgres superuser
    sudo -i -u postgres
    psql
    ALTER USER your_username WITH SUPERUSER;
  • If you can't log in with sudo but have access to the PostgreSQL data directory, you can start PostgreSQL in single-user mode to reset the password
    sudo -u postgres postgres --single -D /var/lib/pgsql/data  (Change your path accordingly)
    ALTER USER postgres WITH PASSWORD 'new_password';
    Exit single user mode and start postgres normally
      

On Thu, 19 Sept 2024 at 18:31, Sunil Jadhav <sunilbjpatil@gmail.com> wrote:
Hello Team,

I have login with non super user in PostgreSQL instance.
How to become a super user
I tried and getting a below error 
 "must be  superuser to alter superuser" 
 How to resolve this?
I don't know the superuser password?

Thanks for your help in advance

Thanks
Sunil jadhav 

В списке pgsql-admin по дате отправления: