Rails:rake db:create:all(无法连接到服务器) [英] Rails: rake db:create:all (could not connect to server)

查看:69
本文介绍了Rails:rake db:create:all(无法连接到服务器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照截屏。更改您的unix套接字位置的文件位置。

2)如果仍然无法连接。验证postgres服务器是否确实在运行

  $ netstat -a | grep postgre 

如果正在运行,请尝试使用 psql 命令。万一它不运行。尝试手动启动

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

如果仍然无法启动,则
是否有任何错误消息在server.log中?如果是,请在此处发布。



祝您好运!
=======更新==============
>


follow the screencasts http://railscasts.com/episodes/342-migrating-to-postgresql?autoplay=true up to the steps of "rake db:create:all" and get 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"?

refer the question on Rails: rake db:create:all fails to connect to PostgreSQL database

but still unable to resolve it. Not sure what is the problem.

[database.yml]

development:
  adapter: postgresql
  encoding: unicode
  database: store_development
  pool: 5
  username: amysukumunu 
  password:
test:
  adapter: postgresql
  encoding: unicode
  database: store_test
  pool: 5
  username: amysukumunu
  password: 

解决方案

[update2]

okay, This is what you should do:

  1. the unix socket should be at /var/pgsql_socket(as per the plist image) where as rails is trying to find the socket file in /tmp. I believe this is the reason for error. so Edit your database.yml & explicitly add socket location. so your final database.yml should look like this. change the file location for your unix socket location. try to connection now?

2) If it still doesn't connect. verify that postgres server is actually running

$ netstat -a | grep postgre

if its running, try connecting to it from terminal using psql command. incase its, not running. try starting it manually

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

If it still doesn't start, Are there any error messages in the server.log? If yes do post them here.

Good luck! =======UPDATED===============

这篇关于Rails:rake db:create:all(无法连接到服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆