postgresql-setup --initdb with custom data directory
12
votes
4
answers
36177
views
I am trying to setup Postgres 12 on Centos 8.
Postgres shall be installed in the default directory i.e.
/var/lib/pgsql
, however I want the data directory to be in /data/pgsql
I want to use postgresql-setup as root, as I believe it will create systemd service files along with it, rather than using pg_ctl or running initdb as postgres user.
However, if I try
$ postgresql-setup --initdb --pgdata=/data/pgsql/
I will receive the following error.
postgresql-setup: unrecognized option '--pgdata=/data/pgsql'
FATAL: can't parse arguments
What is the best way to achieve this?
Asked by zaidwaqi
(221 rep)
May 28, 2021, 04:53 PM
Last activity: Feb 22, 2024, 08:08 PM
Last activity: Feb 22, 2024, 08:08 PM