Threads
References
Docker Cheatsheet:
# Stop and delete container
docker rm -f container-name
# Enter the container using psql
docker exec -it lab-pg17 psql -U postgres
# Build the docker image
docker build -t image-name .
# Create new container
docker run --name lab-pg17 \
-v /path/to/postgres-data:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=secret \
-p 5433:5432 \
-d lab-pg17Meta commands
\conninfo -- show connection's info
\d -- list tables/relations
\db -- list tablespaces
\du -- list users
\dx -- list extensions
\l -- show databasesPostgreSQL config files:
show hba_file; -- pg_hba.conf
show config_file; -- postgresql.confReload without restarting when changing something that loads at the start:
select pg_reload_conf();See user passwords:
select * from pg_shadow;Change a user's password
ALTER USER amree WITH PASSWORD 'password';
\password userSee the current password encryption (md5 or scram-sha-256)
show password_encryption;