Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exit from postgres' single-user mode?

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>
like image 640
mherzl Avatar asked Jul 16 '17 00:07

mherzl


Video Answer


1 Answers

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.

like image 130
Jorge Campos Avatar answered Sep 23 '22 23:09

Jorge Campos