2017-06-04 67 views
0

嘗試運行混合ecto.create混合ecto.create拒絕連接

13:27:47.442 [error] GenServer #PID<0.3189.0> terminating 
** (DBConnection.ConnectionError) tcp connect (localhost:5432):connection refused - :econnrefused 
(db_connection) lib/db_connection/connection.ex:148:DBConnection.Connection.connect/2 
(connection) lib/connection.ex:622: Connection.enter_connect/5 
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 
Last message: nil 
State: Postgrex.Protocol 
** (Mix) The database for Hello.Repo couldn't be created: an exception was raised: 
** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused 
    (db_connection) lib/db_connection/connection.ex:148: DBConnection.Connection.connect/2 
    (connection) lib/connection.ex:622: Connection.enter_connect/5 
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3 

回答

0

你必須確保PostgreSQL服務器運行時收到此錯誤。在Mac OS X上最簡單的方法是通過brew。

運行命令brew services start postgresql,你應該看到的結果是:

==> Successfully started postgresql (label: homebrew.mxcl.postgresql)