May 16, 2014

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.