CLI Notes for PostgreSQL

psql Use

To get to administrator prompt:

sudo su -
su - postgres
psql

DB Access

Give user access to the database from IP address by editing file:

sudo -u postgres vi /etc/postgresql/9.4/main/pg_hba.conf

Add line:

hostssl fireflyd  firefly  10.0.1.13/31 md5

The line above allows firefly user to connect to fireflyd database from 10.0.1.13 IP address. Subnet /31 points to only one IP address.

Reload configuration with:

sudo -u postgres psql
select pg_reload_conf();

systemd

systemctl status postgresql

Manjaro

Install on Manjaro:

pacman -Sy postgresql

Windows

Client Tools on Windows

Download standalone build of PostgreSQL and extract client tools bin directory.