I have been trying for hours to create a database in a specific directory in Ubuntu 14.04.
First I tried
createdb mydb
and I got
createdb: could not connect to database template1: FATAL: role "daniel" does not exist [daniel is my username]
Then I changed the password using
sudo -u postgres psql\password postgres
and I tried
createdb -U postgres -W -E UTF-8 mydb
and I got
createdb: could not connect to database template1: FATAL: Peer authentication failed for user "postgres"
However, I am using the correct password. What must be happening?
By the way, I also tried the solution of Postgress - Password autentication fails
and I get
ALTER ROLE
but the problem persists.