skip to Main Content

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


  1. 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 &
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search