When I run
iex -S mix phx.server I have following error
After this I try to run
psql and it display me the following.
psql: 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"?
I am using raspberrypi and system is running fine before I restart the system.
I try to start postgress service and re-install but all useless.
You probably have done hard-reset without giving PostgreSQL to gracefully shut down which caused leftovers to be present in the system and these leftovers are conflicting with current Postgres instance (probably it is
postmaster.pid file). Check out PostgreSQL logs and then you can try to resolve this problem easily by removing conflicting files.
Has your postgres recently got a major version update? My system was killed by an unattended update from 10 to 11. This made postgres unable to start and I had to use scripts that convert between database format.
You need to consult your operating systems manual about how to properly upgrade your postgres if my assumption is correct.