$ -weight: 600;">sudo -weight: 500;">pacman -Syu
-weight: 600;">sudo -weight: 500;">pacman -Syu
-weight: 600;">sudo -weight: 500;">pacman -Syu
-weight: 600;">sudo -weight: 500;">pacman -S postgresql
-weight: 600;">sudo -weight: 500;">pacman -S postgresql
-weight: 600;">sudo -weight: 500;">pacman -S postgresql
-weight: 600;">sudo -u postgres initdb -D /var/lib/postgres/data
-weight: 600;">sudo -u postgres initdb -D /var/lib/postgres/data
-weight: 600;">sudo -u postgres initdb -D /var/lib/postgres/data
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start postgresql
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start postgresql
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start postgresql
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable postgresql
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable postgresql
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable postgresql
-weight: 500;">systemctl -weight: 500;">status postgresql
-weight: 500;">systemctl -weight: 500;">status postgresql
-weight: 500;">systemctl -weight: 500;">status postgresql
-weight: 600;">sudo -u postgres psql
-weight: 600;">sudo -u postgres psql
-weight: 600;">sudo -u postgres psql
CREATE ROLE myapp WITH LOGIN PASSWORD 'devpass123' CREATEDB;
CREATE ROLE myapp WITH LOGIN PASSWORD 'devpass123' CREATEDB;
CREATE ROLE myapp WITH LOGIN PASSWORD 'devpass123' CREATEDB;
CREATE DATABASE myapp_db OWNER myapp;
CREATE DATABASE myapp_db OWNER myapp;
CREATE DATABASE myapp_db OWNER myapp;
SELECT current_user;
SELECT current_user;
SELECT current_user;
-weight: 600;">sudo nano /var/lib/postgres/data/pg_hba.conf
-weight: 600;">sudo nano /var/lib/postgres/data/pg_hba.conf
-weight: 600;">sudo nano /var/lib/postgres/data/pg_hba.conf
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
local all all md5
host all all 127.0.0.1/32 md5
host all all ::1/128 md5
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart postgresql
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart postgresql
-weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">restart postgresql
psql "postgresql://myapp:devpass123@localhost:5432/myapp_db"
psql "postgresql://myapp:devpass123@localhost:5432/myapp_db"
psql "postgresql://myapp:devpass123@localhost:5432/myapp_db"
psql -U myapp -d myapp_db -h localhost -W
psql -U myapp -d myapp_db -h localhost -W
psql -U myapp -d myapp_db -h localhost -W - Default auth configuration is the “peer” auth. Peer auth uses our OS user to login
- OS user identity is trusted - LOGIN → allows authentication
- PASSWORD → required for apps/ORMs
- CREATEDB → grant access to create databases - trust → no password
- peer → OS identity
- md5 / scram-sha-256 → password-based login - password authentication failed → wrong password
- database does not exist → DB missing
- role does not exist → user missing
- could not connect to server → -weight: 500;">service stopped / wrong port - Always-running -weight: 500;">service
- Config-driven behavior
- URL = connection info only