1

Mac OS X Lion 上的 Ruby 1.9.3

关注了关于这个主题的几篇关于 SO 的帖子。都没有帮助。

尝试在这里运行我的第一个rails 和 postgreSQL 应用程序。

在此之后:http: //guides.rubyonrails.org/getting_started.html

当我做:

"rake db:create"

我得到:

无法连接到服务器:没有这样的文件或目录服务器是否在本地运行并接受 Unix 域套接字“/tmp/.s.PGSQL.5432”上的连接?

一些事实:

不确定 /tmp/ 指的是什么,但如果它是来自根目录的,那么:

1) 权限:

drwxrwxrwx 11 根轮 374B Jan 4 17:33 tmp

2) 另外,我看不到文件 .s.PGSQL.5432。

3)我试图通过将以下内容添加到 database.yml 来强制套接字位置:

development:
    adapter: postgresql
    encoding: unicode
    database: testblog_development
    pool: 5
    username: blog
    password:
    socket: /var/pgsql_socket # <-- this line

(它仍然显示与 /tmp/ 路径相同的错误)。

4)当我这样做时,which postgres我得到:

/usr/local/bin/postgres 
(I've used homebrew installation)

5)当我这样做时:brew info postgres我得到:

postgresql:稳定 9.2.2 http://www.postgresql.org/取决于:readline、ossp-uuid 与:postgres-xc /usr/local/Cellar/postgresql/9.2.2 冲突(2819 个文件,39M)* https ://github.com/mxcl/homebrew/commits/master/Library/Formula/postgresql.rb

和其他一堆信息。

4

2 回答 2

2

在我看来,服务器没有运行。当你从命令行运行时,你看到什么ps aux | grep postgres了吗?如果您看到的只是grep postgres输出中的内容,那么它没有运行。

由于您使用 Homebrew 安装了 PostgreSQL,brew info postgres如果确实如此,请尝试获取有关如何启动服务器的信息。

于 2013-01-04T18:36:53.063 回答
1

您不需要指定套接字。这是适用于 Postgres 的配置。您只需要更改数据库密码。

development:
  adapter: postgresql
  host: localhost
  pool: 5
  timeout: 5000
  username: postgres
  password: postgres
  database: testblog_development
  template: template0
于 2013-01-04T18:13:35.023 回答