Specifying the default database for psql to connect to? Specifying the default database for psql to connect to? postgresql postgresql

Specifying the default database for psql to connect to?


You can configure the default behavior of psql -- and in fact any program using the libpq client library -- through environment variables.

In your ~/.bashrc or similar:

export PGDATABASE=postgres

The PostgreSQL documentation contains a complete list.