6

I have entered postgres' single-user mode

$ sudo -u postgres postgres --single -D /var/db/postgresql/

PostgreSQL stand-alone backend 9.4.11
backend>

What command can I use to close single-user mode and exit back to a normal $ command prompt?


The command \q works to exit from the psql repl, but that same command does not appear to work for postgres single-user mode, i.e.

$ sudo -u postgres postgres --single -D /var/db/postgresql/

PostgreSQL stand-alone backend 9.4.11
backend> \q
ERROR:  syntax error at or near "\" at character 1
STATEMENT:  \q

backend>
3
  • 1
    Should be just \q Commented Jul 16, 2017 at 0:37
  • 1
    @JorgeCampos Unlike psql utility, \q does not appear to work in this case; question edited to show that. Commented Jul 16, 2017 at 0:51
  • Ok, let me retract that vote. Commented Jul 16, 2017 at 0:55

1 Answer 1

7

The answer is on the Postgresql Docs page at Single-User mode. Regarding the exit it states:

To quit the session, type EOF (Control+D, usually). If you've entered any text since the last command entry terminator, then EOF will be taken as a command entry terminator, and another EOF will be needed to exit.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.