[英]ruby on rails cannot connect to postgresql locally
我一直在尝试在rails dev环境中为我刚刚开始工作的项目设置我的ruby。 我已经在Ubuntu 12上安装了Ruby 1.9.3,Rails 3.2和postgresql 9.1.4,当我尝试rake db:create:all我收到消息:
/var/lib/gems/1.9.1/gems/activerecord-3.2.3/lib/active_record/connection_adapters/postgresql_adapter.rb:1194:in `initialize': could not connect to server: No such file or directory (NameError)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
然后我补充说:
主持人:localhost
港口:5432
到我的database.yml文件,它让我做db:create:all和db:migrate,但是当我在本地运行rails服务器时它仍然有同样的错误。
我已经检查过postgresql服务器正在运行,它是(我也知道它正在运行,因为rake之前工作),并尝试了全新安装的postgresql。 我可以缺少什么才能使这项工作?
你确定你的postgres服务器正在运行吗? 如果你做ps -aef|grep postgres
,你应该看到这样的东西:
[root@haddock ~]# ps -aef|grep 'postgres'
postgres 5963 5475 0 21:28 ? 00:00:00 /usr/postgresql/bin/postmaster -D <your postgres directory>
postgres 5972 5963 0 21:28 ? 00:00:00 postgres: writer process
postgres 5973 5963 0 21:28 ? 00:00:00 postgres: wal writer process
postgres 5974 5963 0 21:28 ? 00:00:00 postgres: autovacuum launcher process
postgres 5975 5963 0 21:28 ? 00:00:00 postgres: stats collector process
admin 6750 6607 0 21:30 ttyS0 00:00:00 grep postgres
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.