I installed postgres in my rails application, but I cannot create any roles.
For su - postgres
and psql -d template1 -U postgres
I get psql:FATAL role "postgres" does exist
I also ran createuser -s -U $USER
What am I doing wrong? Thanks!
I installed postgres in my rails application, but I cannot create any roles.
For su - postgres
and psql -d template1 -U postgres
I get psql:FATAL role "postgres" does exist
I also ran createuser -s -U $USER
What am I doing wrong? Thanks!
Here's a list of already answered questions:
Depending on how you installed PostgeSQL, you may not have the role postgres
. For instance, on my machine, when I install PostgreSQL via Homebrew, the install creates the default user as the current logged in user, not postgres
.
Therefore, to login I must use
psql -U <myuser> -h localhost
and not
psql -U postgres -h localhost
You may get the error
psql: FATAL: database "<user>" does not exist
In that case, follow the instructions in this topic to create the user database.