Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I exit/logout from PostgreSQL? [duplicate]

I'm new to psql and using psql command line on Ubuntu. What is the command to logout/exit from command line?

Thank you!

like image 646
Vajira Lasantha Avatar asked May 25 '15 06:05

Vajira Lasantha


People also ask

How do I go back to a database in PostgreSQL?

To back up, a PostgreSQL database, start by logging into your database server, then switch to the Postgres user account, and run pg_dump as follows (replace tecmintdb with the name of the database you want to backup). By default, the output format is a plain-text SQL script file.

How do I clear the screen in PostgreSQL?

Use \! cls to clear screen.

How do I disconnect from database?

To disconnect from a database, click the connection in the Database Navigator or Projects view, and then click the Disconnect button in the toolbar or click Database -> Disconnect on the main menu: You can also right-click the connection and click Disconnect on the context menu.


1 Answers

type \q and press enter to quit from psql from command line. In general the meta commands are preceded by \ for eg- \list or \l: list all databases or \dt: list all tables in the current database

To switch databases:

\connect database_name

If that does not work, you can use CTRL + D. For more help on meta commands you can press \?

Since you are new to psql consider referring to the documentation here

like image 156
inquisitive Avatar answered Sep 23 '22 22:09

inquisitive