[英]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.