daniel lee
daniel lee

Reputation: 85

What is the file path to the data directory of the latest version of PostgreSQL installed in my mac?

There are two versions of PostgreSQL installed in my Mac: 9.6 and 10.1. Currently, when I use the psql command, it's using 10.1 version of the database. I want to figure out the location of the data directory for the latest version. The following command returns the filepath for the version 9.6, not 10.1.

ps auxwww | grep postmaster

What should my terminal command be to get the data directory of the latest version?

Upvotes: 0

Views: 192

Answers (1)

Vao Tsun
Vao Tsun

Reputation: 51466

https://www.postgresql.org/docs/current/static/storage-file-layout.html

PG_VERSION A file containing the major version number of PostgreSQL

so to find all possible $PGDATA, run as root:

find / -name PG_VERSION

Upvotes: 1

Related Questions