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

前端 未结 17 1573
北荒
北荒 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:29

    I often encounter this problem on windows,the way I solved the problem is Service - Click PostgreSQL Database Server 8.3 - Click the second tab "log in" - choose the first line "the local system account".

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

    run postgres -D /usr/local/var/postgres and you should see something like:

     FATAL:  lock file "postmaster.pid" already exists
     HINT:   Is another postmaster (PID 379) running in data directory "/usr/local/var/postgres"?
    

    Then run kill -9 PID in HINT

    And you should be good to go.

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

    If you want to restart Postgresql on Linux, then you have to use the following command.

    /etc/init.d/postgresql restart

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

    First I tried

    lsof -wni tcp:5432 but it doesn't show any PID number.

    Second I tried

    Postgres -D /usr/local/var/postgres and it showed that server is listening.

    So I just restarted my mac to restore all ports back and it worked for me.

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

    I resolved the issue via this command

    pg_ctl -D /usr/local/var/postgres start
    

    At times, you might get this error

    pg_ctl: another server might be running; trying to start server anyway
    

    So, try running the following command and then run the first command given above.

    pg_ctl -D /usr/local/var/postgres stop
    
    0 讨论(0)
  • 2020-12-02 07:35

    For Docker users: In my case it was caused by excessive docker image size. You can remove unused data using prune command:

    docker system prune --all --force --volumes
    

    Warning: as per manual (docker system prune --help):

    This will remove:

    • all stopped containers
    • all networks not used by at least one container
    • all dangling images
    • all dangling build cache
    0 讨论(0)
提交回复
热议问题