混合ecto.create连接被拒绝 [英] mix ecto.create connection refused
问题描述
我在尝试运行mix ecto.create
时收到此错误:
I received this error when trying to run mix ecto.create
:
13:27:47.442 [错误] GenServer#PID< 0.3189.0>终止 **(DBConnection.ConnectionError)TCP连接(localhost:5432):连接被拒绝-:econnrefused (db_connection)lib/db_connection/connection.ex:148:DBConnection.Connection.connect/2 (连接)lib/connection.ex:622:Connection.enter_connect/5 (stdlib)proc_lib.erl:247::proc_lib.init_p_do_apply/3 上一条消息:无 状态:Postgrex.Protocol **(混合)无法创建Hello.Repo的数据库:引发了异常: **(DBConnection.ConnectionError)TCP连接(localhost:5432):连接被拒绝-:econnrefused (db_connection)lib/db_connection/connection.ex:148:DBConnection.Connection.connect/2 (连接)lib/connection.ex:622:Connection.enter_connect/5 (stdlib)proc_lib.erl:247::proc_lib.init_p_do_apply/3
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
推荐答案
您必须确保postgresql服务器正在运行.在Mac OS X上,最简单的方法是通过brew.
You must make sure that the postgresql server is running. The easiest way to this on mac OS X is through brew.
运行命令brew services start postgresql
,您应该看到结果:
Run the command brew services start postgresql
and you should see the result:
==> Successfully started postgresql (label: homebrew.mxcl.postgresql)
这篇关于混合ecto.create连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!