When changing the default port number from 5432 to 5332, why do I get a unix domain socket error? 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:
 vi /var/lib/pgsql/11/data/postgresql.conf

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 &quot;/var/run/postgresql/.s.PGSQL.5432&quot;?

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 ?
You may have changed the port for the PostgreSQL database, but not the client.
Try this:

Update your PostgreSQL configuration to use port 5332 again
Test this by passing the port number when trying to connect:
psql -p 5332


If everything works, change the default port for the command-line client like this:
PGPORT=5332; export PGPORT



Now all calls to psql will act as if it has been invoked with the -p 5332 command-line option.