The initdb command is one of the important steps for starting PostgreSQL.
Cluster is created when initdb is made, and template, template1 and postgres databases are created when initdb is made.
You can think of the Template1 database as a template.
If nothing is specified while creating the database, template1 creates the database by copying the configurations in the database.
1 | /usr/pgsql-13/bin/initdb -D /var/lib/pgsql/13/data/ |
With this command, we can initdb or create a cluster in a different directory.
But if we are going to create it in a different directory, the postgres user must have permission in that directory.
You can change the part after initdb if you want (where it is written /var/lib/pgsql/13/data)
We made initdb, we created our cluster, but there are still two different methods for our PostgreSQL to be standing, not standing. Keep reading my other articles for two methods.