I’m facing this error when I try to start my psql server:
psql: error: could not connect to server: Connection refused
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
The command line that I’m using: psql postgres
2
Answers
Try to make sure you have the postgres server running, because that says the server is not running
If not, start the server and wait a while then try to connect again
For example, to start the server
You can type the following command to run the server:
bin/pg_ctl -D (insert the name of your database here) -l logfile start
to start the server. Note that with this you must be one directory beforebin
.To close the server, type the following command:
bin/pg_ctl -D (name of your database) -l logfile stop
.