osx - psql: FATAL: role "vimarshchaturvedi" does not exist. Postgres.app installation -


i working on os x el capitan version 10.11.3 downloaded postgres app , ran app.

the elephant icon on top says version 9.6.1.0(9.6.1.0)

when click on 'open psql' following output on terminal.

$ '/applications/postgres.app/contents/versions/9.6/bin'/psql -p5432 psql: fatal:  role <username> not exist 

where username. far understand app should create role username , no password.

i tried doing:

psql -h localhost -u <username> 

which gave same error.

following various output got trying out answers posted on so.

$ psql /applications/postgres.app/contents/versions/latest/bin/psql 

after searching bit more ran following command:

psql -h localhost -u postgres postgres=#  

the postgres shell opened up. can explain what's happening?

starting psql without given username (-u ...) tries log in db user of same name current os user. db user has not yet been created.

the default superuser created every db cluster named postgres. don't confuse name of rdbms or system db named postgres other other uses.

the fact can log in user postgres , no pw indicates 2 things:

  1. the user `postgres exists (duh).
  2. it's set password-less access, either .pgpass file or in pg_hba.conf 1 of authentication methods peer , ident or trust. peer likely.

if so, quick fix shell:

createuser -h localhost -u postgres vimarshchaturvedi 

vimarshchaturvedi being os username.

once logged in, can check login roles (= users) exit:

select rolname pg_roles; 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -