I successfully followed the Postgres 11 installation instructions on Centos 7 found here. I am able to successfully create schemas / tables and insert data into the database over port 5432 with no problems.
Now I would like to change the default port to 5332 (or something else, doesn't matter), and I did the following:
Changed the line:
#port = 5432 # (change requires restart)
to look like:
port = 5332 # (change requires restart)
Then restarted postgres service by doing:
systemctl restart postgresql-11.service
Then I change to the postgres user:
su - postgres psql
I'm getting the following error message:
sql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
So apparently there is another reference of port 5432 somewhere, but I am unable to find it.
FYI, if I undo the change I did above (in the file /var/lib/pgsql/11/data/postgresql.conf), then everything works perfectly again over default port 5432.
What else do I need to do to get postgres to run on a different port ?