PostgreSQL Memo

Library

PostgreSQL

Installation

To allow connexions from any host on the internet
Edit the postgresql.conf file

sudo pico /etc/postgresql/13/main/postgresql.conf
# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;

Add users authentification

sudo pico /etc/postgresql/13/main/pg_hba.conf
host    all             all              0.0.0.0/0                       md5
host    all             all              ::/0                            md5

Create your first remotely allowed superuser

sudo -u postgres psql
postgres=# CREATE USER username WITH PASSWORD 'password' CREATEDB SUPERUSER CREATEROLE INHERIT LOGIN REPLICATION BYPASSRLS;
CREATE ROLE
postgres=# \q
sudo service postgresql restart

Admin

The best way to admin the database will be to remotely use pgAdmin you could add users, change passwords and add databases on demand.

By @cGIfl300 in
Tags : #PostgreSQL, #Memo,