How to check status of PostgreSQL server Mac OS X

前端 未结 7 1885
南旧
南旧 2020-12-04 06:52

How can I tell if my Postgresql server is running or not?

I\'m getting this message:

[~/dev/working/sw] sudo bundle exec rake db:migrate 
rake aborte         


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-12-04 07:31

    You probably did not init postgres.

    If you installed using HomeBrew, the init must be run before anything else becomes usable.

    To see the instructions, run brew info postgres

    # Create/Upgrade a Database
    If this is your first install, create a database with:
         initdb /usr/local/var/postgres -E utf8
    
    To have launchd start postgresql at login:
       ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents 
    Then to load postgresql now:     
       launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist 
    Or, if you don't want/need launchctl, you can just run:
        pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
    

    Once you have run that, it should say something like:

    Success. You can now start the database server using:

    postgres -D /usr/local/var/postgres or
    pg_ctl -D /usr/local/var/postgres -l logfile start
    

    If you are still having issues, check your firewall. If you use a good one like HandsOff! and it was configured to block traffic, then your page will not see the database.

提交回复
热议问题