snippetsqlCritical
How do I find PostgreSQL's data directory?
Viewed 0 times
postgresqldirectoryhowfinddata
Problem
I forgot how I started PostgreSQL the last time (it was months ago) and I don't remember where the data directory is located. The
I'm on MacOsX if that helps.
Using the answers provided below, I found that it was here:
postgres command seems to require the location of the data directory. I'm on MacOsX if that helps.
/usr/local/postgres doesn't exist on my Mac.Using the answers provided below, I found that it was here:
/usr/local/var/postgresSolution
If you can connect to the database with superuser access, then
is the shortest way.
If the server is not running and you forgot where the data directory was, then you really have to guess yourself. An operating system specific convention or the shell history might provide hints.
SHOW data_directory;is the shortest way.
If the server is not running and you forgot where the data directory was, then you really have to guess yourself. An operating system specific convention or the shell history might provide hints.
Code Snippets
SHOW data_directory;Context
StackExchange Database Administrators Q#1350, answer score: 242
Revisions (0)
No revisions yet.