How to add role to the PostgreSQL

If you need have superuser access to PostgreSQL via command line psql utility, create needed username first:

sudo -u postgres createuser NEEDED_USERNAME

You will be asked whether role should be a superuser:

Shall the new role be a superuser? (y/n)

answer Y (yes) if so and hit Enter.
Now you have NEEDED_USERNAME allowed to access databases as a superuser via psql.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.