pg_ctl: no database directory specified and environment variable PGDATA unset
If you tried to run something like:
and got the following error:
Then you probably need to specify the data directory (or database cluster) to your PG server.
If you don’t already has a directory for this:
Then initialize your data directory using the command initdb and the created directory:
Hopefully everything will work now and you can initialize/restart your server again: