2016-11-13 73 views
-1

不斷得到這個當我運行bundle exec rake db:create束EXEC耙分貝:創建錯誤

could not connect to server: Connection refused 
    Is the server running on host "localhost" (::1) and accepting 
    TCP/IP connections on port 5432? 
could not connect to server: Connection refused 
    Is the server running on host "localhost" (127.0.0.1) and accepting 
    TCP/IP connections on port 5432? 

任何想法如何解決這一問題?

+0

您正在使用什麼數據庫? Postgres的? – Pragun

+0

你運行過postgresql服務器嗎? – falsetru

+0

是使用Postgres db。試圖運行這個應用程序:github.com/harrystech/prelaunchr – user4210063

回答

0

這可能是因爲權限問題。導航到/etc/postgresql/<your version of pg>/main/並打開pg_hba.conf。

在那裏搜索一行會說 local all postgres peer並將其替換爲local all all trust。然後在您的終端中運行sudo service postgresql restart

0

試試這個:

它將工作

database.yml應該是這樣的:

development: 
    adapter: postgresql 
    encoding: unicode 
    database: <DATABASE_NAME> 
    pool: 5 
    username: <username> 
    password: <password> 
    host: localhost 
    port: 5432 

這將是相同的另一個環境

+0

仍然收到相同的錯誤。我試圖運行這個應用程序,如果有幫助的話:https://github.com/harrystech/prelaunchr – user4210063

+0

你在database.yml中添加了這個:port:5432 – Ranzit