linux - Postgres: psql: FATAL: role "postgres" does not exist -


i have been using postgresql couple of days , has been working fine. have been using through both default postgres database user user permissions.

in middle of day today (after had been working fine) stopped working , no longer database. try: psql , come psql: fatal: role "postgres" not exist.

similarly, if tried other user, psql -d postgres come psql: fatal: role "otheruser" not exist. (note have database named postgres , has been working until now).

update

it appears 1 of computers accessing server crashed , may have somehow deleted of users of database. try fresh reinstall.

to check users exist without being able log in psql, can use following method:

  • stop postgres
  • restart in single user mode (specifying data directory)
  • query pg_user global table
  • restart postgres normally

example:

 $ sudo -i -u postgres ... postgres@u64:/usr/local/pg95a1$ bin/postgres --single -d $pwd/data  postgresql stand-alone backend 9.5alpha1 backend> select usename pg_user;      1: usename (typeid = 19, len = 64, typmod = -1, byval = f)     ----      1: usename = "postgres"    (typeid = 19, len = 64, typmod = -1, byval = f)     ----      1: usename = "daniel"  (typeid = 19, len = 64, typmod = -1, byval = f)     ----      1: usename = "joe" (typeid = 19, len = 64, typmod = -1, byval = f)     ----      1: usename = "bob" (typeid = 19, len = 64, typmod = -1, byval = f)     ---- 

ctrld terminate single-user session.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -