How to become the postgres superuser?

(Zach Alexander) #1

I’m using Docker, and trying to run pg_resetxlog to fix a corrupted database. But it complains

pg_resetxlog: cannot be executed by "root"
You must run pg_resetxlog as the PostgreSQL superuser.

(Zach Alexander) #2

In case anyone else runs into a similar problem – this is only difficult if you try to run pg_resetxlog from outside the container. From inside the container (./launcher ssh app) I think su - postgres followed by path/to/pg_resetxlog /shared/path/to/db [-f] worked fine.

(system) #3

(Jeff Atwood) #4