Roles and Databases
Upon installation, Postgres is set up to use peer authentication, meaning that it associates Postgres roles with a matching Unix/Linux system account. If a role exists within Postgres, a Unix/Linux username with the same name is able to sign in as that role.
The installation procedure created a user account called postgres that is associated with the default Postgres role. In order to use Postgres, you can log into that account.
Creating a New Role
Enter name of role to add: sammy
Shall the new role be a superuser? (y/n) y
Switching Over to the postgres Account
Switch to the postgres user
Create a db
Access the postgres command promnt
Exit the command prompt
Updating user password
Update the listening interface
Open postgres interactive session
From the postgres interactive session
Open the config file
Search for the
listen and uncomment and update with the required network interface ip or
0.0.0.0 for any interface.
pg_hba.conf file and add
Save and close the file. Restart postgres.