error with postgresql datababse : Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?

后端 未结 8 804
执笔经年
执笔经年 2021-02-05 17:09

When I run the rake db:migrate or run the rails s command, I get the same error:

Error : could not connect to server: 
No such file or         


        
8条回答
  •  终归单人心
    2021-02-05 17:28

    The exact same symptom can be caused by a stale lock file /var/run/postgresql/.s.PGSQL.5432.lock. One of the symptoms of this is psql reporting

    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"?

    even though there is clearly a socket with this path available as reported by netstat -lp --protocol=unix | grep postgres

    The problem can be solved by removing the lock file and restarting postgresql. This is definitely less invasive than a purge and re-install.

    sudo rm /var/run/postgresql/.s.PGSQL.5432.lock
    sudo service postgresql restart
    

提交回复
热议问题