运行rails应用程序时出现PG错误

时间:2012-01-24 09:56:58

标签: ruby-on-rails postgresql

在运行我的rails应用程序时,我收到以下错误

PGError (could not connect to server: Connection refused
        Is the server running locally and accepting
        connections on Unix domain socket "/tmp/.s.PGSQL.1024"?
):

我尝试了命令

/etc/init.d/postgresql restart

我得到以下内容:

Stopping postgresql service:                               [FAILED]
Initializing database: mkdir: cannot create directory `/var/lib/pgsql/data/pg_log': File exists
                                                           [FAILED]
Starting postgresql service:                               [FAILED]

1 个答案:

答案 0 :(得分:0)

此错误与Ruby on Rails无关。您应该检查PostgreSQL日志目录的权限。此外,您需要确保以root身份启动Postgres守护程序:

    sudo /etc/init.d/postgresql start