Rake interrupted, connection failed do postgresql: connection refused

I am trying to execute the rake command in my new rails project with postgresql, but I get this error:

rake is interrupted! Could not connect to server: connection rejected. a server running on the localhost host (127.0.0.1) and accepting TCP / IP connections on port 5432?

Tasks: TOP => db: migrate (see the full trace by running the task with --trace)

real 0m3.245s user 0m1.668s sys 0m0.382s

This is my first application for rails because I am running rails server , this is the result:

=> Download WEBrick

=> Rails 3.2.3 application starting with the development of http://0.0.0.0:3000

=> Call with -d to disconnect

=> Ctrl-C to shut down the server [2012-06-19 01:17:30] INFO WEBrick 1.3.1 [2012-06-19 01:17:30] INFO ruby ​​1.9.3 (2012-04-20 )

[x86_64-darwin11.3.0] [2012-06-19 01:17:30] INFO

WEBrick :: HTTPServer # start: pid = 4668 port = 3000

Rails -v: Rails 3.2.3

gem env:

RubyGems environment: - RUBERS VERSION: 1.8.24 - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.3.0] - INSTALLATION INSTRUCTIONS: /Users/kinhow/.rvm/gems/ruby- 1.9.3-p194 - RUBY EXECUTIVE: /Users/kinhow/.rvm/rubies/ruby-1.9.3-p194/bin/ruby - EXECUTIVE CATALOG: /Users/kinhow/.rvm/gems/ruby-1.9.3- p194 / bin - RUBIGEY PLATFORMS: - Ruby - x86_64-darwin-11 - GEM PATHS: - / Users / kinhow / .rvm / gems / ruby-1.9.3-p194 - / Users / kinhow / .rvm / gems / ruby-1.9.3-p194@global - GEM CONFIGURATION: -: update_sources => true -: verbose => true -: benchmark => false -: backtrace => false -: bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/

if this helps:

running psql

psql: cannot connect to server: no such file or directory. does the server work locally and accepts connections in the Unix socket domain "/tmp/.s.PGSQL.5432"?

+4
source share
1 answer

First, you need to make sure postgresql is running. Open the console and run "ps auxw | grep post" and make sure the server is running. You must have at least four processes, including the "postgres: writer process". If you do not, you have not started it. Even if you run it, you must configure it to listen on the corresponding port (127.0.0.1 and "localhost"). Have you edited the postgres.conf file and the pg_hba.conf files? If so, restart the server? Are you using the latest pg gem? How to start the server?

~ Charles ~

+3
source

All Articles