sajad torkamani

First, make sure you’ve installed Postgres. Let’s assume you’re logged in as the Unix user sajad.

Create superuser role

sudo -u postgres createuser --interactive

When prompted:

  • Give it the name of your main Unix user (e.g., sajad).
  • Make it super user

Create default database for role

When you login as any role (e.g., sajad), PG will attempt to connect to a database with the same name as the role by default.

So, you might want to create a default role database:

sudo -u postgres createdb sajad

Test connection

psql

You should be logged in as the role sajad and connected to the database sajad.

Tagged: Postgres

Leave a comment

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