“Essential PostgreSQL Environment Variables Every DBA Should Know”
PostgreSQL Environment Variables
PGHOST
Defines the hostname of the server to connect to. If empty, connects using a Unix domain socket.
PGPORT
Specifies the TCP port (default is 5432) or the socket file extension.
PGDATABASE
Sets the default database name to connect to if none is specified.
PGUSER
Specifies the default PostgreSQL user (role) for authentication.
PGPASSWORD
Supplies the password used if the server requires password authentication. (Note: Avoid using in production for security reasons.)
PGREALM
Overrides the default Kerberos realm for authentication.
PGOPTIONS
Passes additional command-line options to the backend server (e.g., -c work_mem=4MB).
PGTTY
sets the file or tty on which debugging messages from the backend server are displayed
PGSERVICE
Refers to a service name defined in a .pg_service.conf file to simplify connection strings.
PGSERVICEFILE
Specifies the path to a custom .pg_service.conf file.
PGSSLMODE
Controls SSL usage. Options: disable, allow, prefer, require, verify-ca, verify-full.
PGSSLROOTCERT
Path to the root certificate file for verifying the server certificate.
PGSSLCRL
Specifies the certificate revocation list file used during SSL verification.
PGKRBSRVNAME
Kerberos service name (default is “postgres”). Used in GSSAPI authentication.
At Learnomate Technologies, we provide the best training on PostgreSQL and other database technologies. For more insights, visit our YouTube channel. Don’t forget to check out our website for more details about our training programs. Follow my Medium account @ankush.thavali for more articles and updates.