3
我一直在嘗試在rails開發環境中爲我剛開始工作的項目設置ruby。我已經安裝了Ruby 1.9.3,在Ubuntu 12的Rails 3.2和PostgreSQL 9.1.4,當我嘗試耙分貝:創建:我得到的消息:ruby on rails無法連接到本地postgresql
/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"?
我接着說:
主持人:本地主機
端口:5432
我的database.yml文件,它讓我做DB:創建:所有和db:遷移,但是當我在本地運行軌道服務器它仍然有同樣的錯誤。
我檢查過postgresql服務器正在運行,它是(我也知道它是從早期的rake工作以來運行的),並且嘗試過新安裝postgresql。我可能會錯過什麼來完成這項工作?
此外,沒有你的Postgres服務器有標準配置? – rmk
它確實有標準的配置,直到幾分鐘前,當我修改它以在讀取http://askubuntu.com/後在postgresql.config中具有unix_socket_directory ='/var/run/postgresql/.s.PGSQL.5432'時問題/ 50621/can not-connect-to-postgresql-on-port-5432。另外,當我在更改配置並重新啓動之前運行ps -aef | grep postgres時,我看到了類似的東西,但現在我沒有看到任何進程。現在,當運行rails服務器時,我得到一個錯誤,指出連接被拒絕,並檢查它是否在TCP/IP端口上運行5432 – FlyingCube
您是否在postgres配置中使用了-h localhost選項?如果沒有,那麼你會得到你提到的錯誤。 – rmk