5

I run this code as root:

/usr/local/bin/postgres -D /usr/local/pgsql/data

because it wanted me to run it.

However it gives this error;

"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise. See the documentation for
more information on how to properly start the server.

How can I login into PostgreSQL? Isn't it possible to use it with root user?

Some notes: This is PostgreSQL 9.4 (beta, but 9.3 gives me same error) on FreeBSD 10. PostgreSQL was installed via Ports. I think I have a "pgsql" user because it said

===> Registering installation for postgresql94-server-9.4.b3
===> Creating users and/or groups.
Using existing group 'pqsql'.
Using existing user 'pqsql'.
3
  • 1
    Postgres does this for security reasons. You should log in as the "postgres" user (apparently named pgsql in your installation) and start the server from that user. Oct 20, 2014 at 21:01
  • Doesn't it install a README or something with setup instructions? (I don't use FreeBSD). Oct 20, 2014 at 21:30
  • @CraigRinger, it gives you several instructions (that most of them work) while installing but one has to be really fast to read, remember and understand what is going on.
    – ilhan
    Oct 20, 2014 at 22:16

1 Answer 1

0

if there is sudo permission then

sudo -u postgres psql

or using docker postgres if just root access try

su - postgres

then

psql
New contributor
Zaman Oof is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.