i'm new to ruby on rails, i'm trying to run an app with postgres database, but it didn't work, i have tried to search lots of information, but i wasn't useful, Someone posted the exactly same question here Problems with rails server , I tried to use command rails new blog it created an app with sqlite3 database, it works fine, but i created app with command rails new myapp --database=postgresql after that i visit localhost page, it ocurred the exactly same error

could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Can anyone help? it would be very much appreciated.

database.yml file information:

default: &default
  adapter: postgresql
  encoding: unicode
  pool: 5

development:
  <<: *default
  database: myapp_development

test:
  <<: *default
  database: myapp_test

production:
  <<: *default
  database: myapp_production
  username: myapp
  password: <%= ENV['MYAPP_DATABASE_PASSWORD'] %>
  • Can you include your config/database.yml file in your question please? – Luca B. Aug 21 '14 at 7:51
  • Hello, i have just included the yml file, Thank you very much – TheFirefly Aug 21 '14 at 7:58
  • please include pg_hba.conf – tty6 Aug 21 '14 at 8:00
  • Did you check your db is actually running on it's default port? Also what environment you're currently running the app in? – Luca B. Aug 21 '14 at 8:00
  • Hello, i'm a beginner,I couldn't find pg_hba.conf. I am running it on my local MAC OS 10.9.4 ,Thank you guys. – TheFirefly Aug 21 '14 at 8:08
up vote 0 down vote accepted

Delete this file:

/usr/local/var/postgres/postmaster.pid

Original Answer: psql: could not connect to server: No such file or directory (Mac OS X)

  • Thanks for Answering this question, i think your comment inspired my to solve the issue, It's related. Here is the link i followed up with, i reinstalled home-brew and Postges moncefbelyamani.com/… – TheFirefly Aug 21 '14 at 12:02

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.