Postgres.app Could not start on port 5432

后端 未结 24 1045
暗喜
暗喜 2021-01-29 22:24

I\'m using http://postgresapp.com. In the menubar it gives the error \" Could not start on port 5432.\" Similarly if I try to start the server from the terminal, I get:

相关标签:
24条回答
  • 2021-01-29 22:52

    You my have another instance of postgres running, that is the only application interested in this port. You should use netstat and ps to determine this. Then stop the instance and uninstall it, you mayhave installed enterpiseDb for example, that is what I did.

    0 讨论(0)
  • 2021-01-29 22:52

    A file named "postmaster.pid" (in my $PGDATA directory) were preventing postgresql to start. It was a zombie file, placed there 10 days ago and when I brutally shut down the computer (pulling the plug, literally), no clean up process had the opportunity to remove that file.

    0 讨论(0)
  • 2021-01-29 22:52

    This is what worked for me: $ sudo pkill -u postgres

    Props to this resource: https://github.com/PostgresApp/PostgresApp/issues/197#issuecomment-474534056

    0 讨论(0)
  • 2021-01-29 22:53

    When trying to open the Postgres app was getting that same error regarding post 5432 (on Mac OSX 10.10.5)

    I did:

    $ lsof -i | grep LISTEN
    

    Saw which PID was running postgres at that port, did: $ killall {pid} and then $ brew uninstall postgres

    After that, restarted my Mac, and ran:

    $ lsof -i | grep LISTEN again just to make sure. Saw no postgres running anywhere and was able to open the Postgres app without getting that warning.

    Then I reinstalled postgres with $ brew install postgres

    ANOTHER OPTION:

    (I also tried this one time when the above approach didn't work and I could not kill any of the PID)

    $ ps auxw | grep post
    

    Saw a slew postgres processes, which I then sudo kill <PID>

    Everything working fine now.

    0 讨论(0)
  • 2021-01-29 22:53

    I generally face this issue on my mac, and this fixes it for me always

    rm /usr/local/var/postgres/postmaster.pid
    brew services restart postgresql
    

    Hope this is helpful

    0 讨论(0)
  • 2021-01-29 22:54

    You can stop the process by finding the PID with

    lsof -i :5432
    

    and then killing it with

    kill -9 <PID>
    
    0 讨论(0)
提交回复
热议问题