Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?

前端 未结 17 1571
北荒
北荒 2020-12-02 06:37

Before anything, please note that I have found several similar questions on Stack Overflow and articles all over the web, but none of those helped me fix my issue:

相关标签:
17条回答
  • 2020-12-02 07:19

    This could be caused by the pid file created for postgres which has not been deleted due to unexpected shutdown. To fix this, remove this pid file.

    1. Find the postgres data directory. On a MAC using homebrew it is /usr/local/var/postgres/, other systems it might be /usr/var/postgres/

    2. Remove pid file by running:

      rm postmaster.pid
      
    3. Restart postgress. On Mac, run:

      brew services restart postgresql
      
    0 讨论(0)
  • 2020-12-02 07:22

    This worked in my case:

    brew uninstall postgresql
    rm -fr /usr/local/var/postgres/
    brew install postgresql
    
    0 讨论(0)
  • 2020-12-02 07:26

    The postgresql server might be down and the solution might be as simple as running:

    sudo service postgresql start
    

    which fixed the issue for me.

    0 讨论(0)
  • 2020-12-02 07:26

    It also gives the same error if you just stop your PostgreSQL app. You just need to start it again. (PostgreSQL 11)

    0 讨论(0)
  • 2020-12-02 07:28

    I had almost just as same error with my Ruby on Rails application running postgresql(mac). This worked for me:

    brew services restart postgresql
    
    0 讨论(0)
  • 2020-12-02 07:29

    You most likely ran out of battery and your postgresql server didn't shutdown correctly.

    The easiest workaround is to download the official postgresql app and launch it: it will force the server to start (http://postgresapp.com/)

    0 讨论(0)
提交回复
热议问题