I would like to su
to the postgres user on Mac, so that I can run postgres.
What am I doing wrong here?
delirium:~ anna$ sudo su postgres
delirium:~ anna$
Nothing happens. If I try to run postgres, I then get something like this:
delirium:~ anna$ sudo pg_ctl -D /usr/local/var/postgres -l
/usr/local/var/postgres/server.log startpg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.
If I try this in order to su
, I also get an error:
delirium:~ anna$ sudo su - postgres
su: no directory
delirium:~ anna$
What can I do instead? I'm fairly sure that the postgres user exists.
That looks consistent with the postgres user not having a login shell. Try sudo -u postgres bash
PostgreSQL is integrated in Server.app available through the App Store in Mountain Lion.
You would have this file: /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist
You can sudo:
sudo -u _postgres psql template1
Or connect:
psql -h localhost -U _postgres postgres
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With