Changing default PGDATA for PostgreSQL 9.5 in RedHat 7

By default Red Hat and Centos OS stores the database in the file system /var/lib/pgsql/data/. The area where the database is located can be changed depending on individual environment requirements or preferences. So to speak, in this post I will show how to change this location. First, let’s check the current location of the PostgreSQL using the command “SHOW data_directory;” inside one of the databases. You can see in the example above that the location of the database files are the default location for RedHat which is “/var/lib/pgsql/9.5/data “. So…