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 ALTERUSER 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