-1

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 Answers2

1

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 before bin.

To close the server, type the following command: bin/pg_ctl -D (name of your database) -l logfile stop.

Matheus Farias
  • 716
  • 1
  • 10
0

Try to make sure you have the postgres server running, because that says the server is not running

# in case of running through postgres
ps -aux | grep postgres
# in case of running through pg_ctl
ps -aux | grep pg_ctl

If not, start the server and wait a while then try to connect again

For example, to start the server

/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data >logfile 2>&1 &