pg_ctl: no database directory specified and environment variable PGDATA unset , centos 7 postgreSQL

centos 7 postgreSQL pg_ CTL invalid

In the
section

~/.bash_profile

Next configuration

export PGDATA=/var/lib/pgsql/11.0/data 

But it didn’t work.

However, it can be written like this

Go to

/usr/pgsql/bin

After that, it can be executed

./pg_ctl -D /var/lib/pgsql/11.0/data start

Take notes

Read More: