PostgreSQL

PostgreSQL List all databases

To list all databases in PostgreSQL database, first connect to PostgreSQL database using psql command

Now run

This will list all available databases.

To change to a database, use command /connect

Once you connected to a database, you can list all tables in a database with command

Backup PostgreSQL Database

To backup PostgreSQL database, run

Example

PostgreSQL

Create user in PostgreSQL

Method 1

To create user, become user “postgres” with

now run

Method 2

You can run following commands in psql prompt

https://www.postgresql.org/docs/8.0/static/sql-createuser.html

PostgreSQL

PostgreSQL

To install PostgreSQL on Ubuntu/Debian, run

Start it with

By default user “postgres” have full access on PostgreSQL. To create a user, run

To create database, run

You can see help with