PostgreSQL error: Fatal: role "username" does not exist

If you want to login to Postgres using the username root you need to first create such a user.

You first need to login as the Postgres super user. This is typically postgres (and is specified during installation):

psql -U postgres <user-name>

Then you can create roles and databases:

psql (9.4.0)
Type "help" for help.

postgres=# create user root with password 'verysecret';
CREATE ROLE
postgres=# \q

c:\
c:\>psql -U root postgres
psql (9.4.0)
Type "help" for help.

postgres=>

Logged in as the superuser you can also grant the root user the necessary privileges.

All parameters for psql are documented in the manual.

Creating users and databases is also documented in the manual:

  • connecting to the database
  • create user
  • create database