psql fatal role does not exist
Use the postgres user:
sudo su postgres
and then use psql.
If you still face problems check this link: PostgreSQL error: Fatal: role "username" does not exist
sudo -u postgres createuser user
may help you to create a new user with all the privileges of postgres
As pointed out in the comments, your pg_hba.conf seems fine.
Usually, the database will run as the postgres user (check ps aux | grep postgres
to find out the username postgres is running under).
Log in as that user, for example sudo su - postgres
, then create a user matching your normal Ubuntu user account (createuser username
), and finally create a database with that same name and set the owner (-O
) to that database user, like this: createdb -O username username
).
That should make calling psql
work, and pgadmin - as long as you start it as your default user, username - should work as well.
Edit: By default, psql
will use your Linux username as default value for both the database-username and the database-name. You can override the username by using -U someotherusername
, and connect to a different database by adding that DB name to the command line, such as psql someotherdbname
. You might also find psql -l
useful for listing the existing databases.