Run PostgreSQL in Docker

To run PostgreSQL on docker, create a directory for saving the data presistant

run docker container

In above, change the value for POSTGRES_DB, POSTGRES_USER and POSTGRES_PASSWORD as needed. Connect to PostgreSQL server To connect to PostgreSQL server, run

Now you are inside PostgreSQL conainer, to login, run

It will ask for […]

Read More…

PostgreSQL List all databases

PostgreSQL

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

[…]

Read More…

PostgreSQL Create Database

To create a database, run

Creating user, grant permissions

Creating a User and Database using psql

[…]

Read More…

Backup PostgreSQL Database

To backup PostgreSQL database, run

Example

PostgreSQL […]

Read More…

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 […]

Read More…

PostgreSQL

List all databases in PostgreSQL pg_ctl Creating user in PostgreSQL PostgreSQL Create Database PostgreSQL Delete a Database Backup PostgreSQL Database PostgreSQL Export table into CSV file Run PostgreSQL in Docker To install PostgreSQL on Ubuntu/Debian, run

Start it with

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

Read More…