0

I manually built postgresql-13.11 on an m1 mac.

When attempting to run either /path/to/postgres/bin/postgres (same for postmaster), i get the following error:

postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.

which i was able to bypass by running /path/to/postgres/bin/postgres -D /path/to/databaseDir, postgres starts normally.

  1. Does that mean the server can only start for a single database?

Clusters are stored as a directory referred to as base directory.

  1. Does that mean all my databases are stored directly under /path/to/postgresDir / Where exactly is the base directory ?
YosefAhab
  • 64
  • 10
  • From the manual: "In file system terms, a database cluster is a single directory under which all data will be stored. We call this the data directory or data area." Every database, every table, every other object will be in this directory. https://www.postgresql.org/docs/15/creating-cluster.html – Frank Heikens Jul 14 '23 at 12:23

1 Answers1

0

Once you initiated a database cluster by executing /path/to/postgres/bin/initdb /path/to/databaseDir, you can create as many databases you want in the cluster using the query postgres=# CREATE DATABASE your_database in your default database, and you can connect to that using postgres=# \c your_database.

You can also create multiple database clusters with their own set of databases by initiating the second database cluster /path/to/postgres/bin/initdb /path/to/databaseDir2 but you have to ensure that they are all isolated and running on different ports.