Cannot create role, no default superuser role exists

From: Robert McAlpine <rem(at)pfcta(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Cannot create role, no default superuser role exists
Date: 2016-03-11 00:11:18
Message-ID: CACisWYEYWS0Ndn4c6nHqKfxBz1xBcYYwdwDgvY6G4HDW4nN0dA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Postgresql 9.5, Ubuntu 14.04.

I broke my ability to access postgres after attemping to install
postgres-xc (ironic, since I installed that to use pg_ctl to reload my
pg_hba.conf without restarting the entirety of postgres).

After doing so I can no longer access my databases via psql or any other
utilities, getting the error:

FATAL: role "postgres" does not exist

Unfortunately the same error gets thrown if I attempt to use 'createuser'.

The postgres user and role were the only ones able to access postgresql
server, so altering the permissions in my pg_hba.conf also got me nowhere.

I made a complete copy of the data directory, took a snapshot (it is on a
vm), then purged postgresql-9.5 and reinstalled, restoring to a dump that
is a few days old. I thought about copying all the files from the data
directory (except for the roles table file) into a fresh install with a
correct default postgres role, but my gut tells me that screwing around
with those files is doomed to fail.

I would appreciate any help or thoughts on how to recover access to the
data.
--
Robert McAlpine
rem(at)pfcta(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-03-11 00:44:56 Re: Cannot create role, no default superuser role exists
Previous Message david 2016-03-10 23:29:11 Re: How to find configuration data in _PG_init()