Re: How to make superuser from non superuser in PostgreSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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 

[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux