PG Error could not connect to server: Connection refused Is the server running on port 5432?

前端 未结 2 975
小蘑菇
小蘑菇 2020-12-28 23:22

I recently updated my machine (MacBook Pro running Mountain Lion) and ever since then, whenever I set up a rails project, my machine craps out and cannot connect to PG. Curr

相关标签:
2条回答
  • 2020-12-29 00:00

    Run in your command line

    postgres -D /usr/local/var/postgres
    

    If the result is like the next one

    LOG:  skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
    FATAL:  database files are incompatible with server
    DETAIL:  The data directory was initialized by PostgreSQL version 10, which is not compatible with this version 11.
    

    Run

    brew postgresql-upgrade-database
    

    Based in this post

    0 讨论(0)
  • 2020-12-29 00:13

    This is quite easy than your think because If you update your mac then process is running but postmaster.pid file is missing from /usr/local/var/postgres/ here. so you need to start process for postgres which create postmaster.pid.

    If progress is running then -

    Stop manually:

    pg_ctl -D /usr/local/var/postgres stop -s -m fast
    

    Start manually:

    pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
    

    now all are working...

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