Postgres.app Could not start on port 5432

后端 未结 24 1046
暗喜
暗喜 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 23:10

    I had this same issue and mine was caused by some configuration issues I was having. Clearing the user configurations and reinstalling postgres in brew worked for me!

    brew uninstall postgresql
    rm -rf /usr/local/var/postgres

    0 讨论(0)
  • 2021-01-29 23:11

    At a guess, something else had taken port 5432 so the app chose to run on 5433 instead.

    Why not just connect to Pg on port 5433, if that's where it's running? You have a /tmp/.s.PGSQL.5432 socket file, so you can connect with psql -p 5433 for UNIX domain socket connections. It'll also be listening on the same port with TCP/IP, so you can use psql -h localhost -p 5433 for TCP/IP and have your apps connect to port 5433 instead of 5432.

    Change your .psqlrc to set the new port as default and you can forget it isn't on the default port.

    0 讨论(0)
  • 2021-01-29 23:14

    If you are running your server on a macOS machine and installed Postgres through Homebrew, you can stop the current instance like this:

    brew services stop postgresql

    Then click the Elephant in the native menu-bar at the top of the screen and it should successfully startup.

    0 讨论(0)
  • 2021-01-29 23:16

    I have tried just about every solution to this problem that is out there. For me it always happens when my MacBook's battery dies, even if the computer is already sleeping. I was poking around in ~/Library/Application\ Support/Postgres/var-9.4 and I discovered another postmaster.pid file that I had not seen before. I deleted it, and now everything is back up and running! I am running the Postgres.app version, not the brew version.

    Steps I took:

    1. Make sure postgres.app is not running.
    2. Run rm ~/Library/Application\ Support/Postgres/var-9.$X/postmaster.pid
    3. If you don't have a var-9.$X directory, just run rm ~/Library/Application\ Support/Postgres/postmaster.pid
    4. Restart postgres.app
    5. Get back to developing cool stuff.
    0 讨论(0)
  • 2021-01-29 23:17

    The same problem just happened to me. I had Postgres.app 9.2.4.1 running since a while. When I updated Mac OS X to 10.8.5, after the mandatory reboot it was not working anymore. I tried several things, including updating to 9.2.4.3 and neither after another reboot it was working.

    I had to open the file /Users/$USER/Library/Application Support/Postgres/var/postgresql.conf and to:

    1. uncomment line unix_socket_permissions = 0777
    2. uncomment and adapt line unix_socket_directory = '/tmp'

    After a restart, Postgres.app was running like a charm.

    0 讨论(0)
  • 2021-01-29 23:18

    Somehow I totally forgot that this socket file will be hidden because of the dot. Make sure you use ls -A /tmp/.s.PGSQL.5432 if you are checking to see if the socket is actually there.

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