Find PostgreSQL data dir from PostgreSQL

Annexe

This post originally appeared on the Annexe.

Assuming you can access your database:

postgres=# SHOW data_directory

On Debian Wheezy with the official PostgreSQL repo, the default will show:

    data_directory
---
 /var/lib/postgresql/9.3/main
(1 row)

Too easy :).

Author bio and support

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.