【发布时间】:2021-01-16 20:27:50
【问题描述】:
我从凤凰开始。我有一个 PostgreSQL 数据库,用户名“postgres”和“root”作为密码。 它们在 config/dev.exs 文件中被正确修改。
但是,当我运行“mix ecto.create”命令时,我遇到了这个错误:
16:10:29.607 [error] GenServer #PID<0.218.0> terminating
** (RuntimeError) Connect raised a FunctionClauseError error. The exception details are hidden, as
they may contain sensitive data such as database credentials.
(postgrex 0.12.2) lib/postgrex/messages.ex:371: Postgrex.Messages.decode_auth_type/1
(postgrex 0.12.2) lib/postgrex/messages.ex:64: Postgrex.Messages.parse/3
(postgrex 0.12.2) lib/postgrex/protocol.ex:1730: Postgrex.Protocol.msg_decode/1
(postgrex 0.12.2) lib/postgrex/protocol.ex:1704: Postgrex.Protocol.msg_recv/3
(postgrex 0.12.2) lib/postgrex/protocol.ex:426: Postgrex.Protocol.auth_recv/3
(postgrex 0.12.2) lib/postgrex/protocol.ex:353: Postgrex.Protocol.handshake/2
(db_connection 1.1.3) lib/db_connection/connection.ex:135: DBConnection.Connection.connect/2
(connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for Discuss.Repo couldn't be created: an exception was raised:
** (RuntimeError) Connect raised a FunctionClauseError error. The exception details are hidden, as
they may contain sensitive data such as database credentials.
(postgrex 0.12.2) lib/postgrex/messages.ex:371: Postgrex.Messages.decode_auth_type/1
(postgrex 0.12.2) lib/postgrex/messages.ex:64: Postgrex.Messages.parse/3
(postgrex 0.12.2) lib/postgrex/protocol.ex:1730: Postgrex.Protocol.msg_decode/1
(postgrex 0.12.2) lib/postgrex/protocol.ex:1704: Postgrex.Protocol.msg_recv/3
(postgrex 0.12.2) lib/postgrex/protocol.ex:426: Postgrex.Protocol.auth_recv/3
(postgrex 0.12.2) lib/postgrex/protocol.ex:353: Postgrex.Protocol.handshake/2
(db_connection 1.1.3) lib/db_connection/connection.ex:135: DBConnection.Connection.connect/2
(connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
(stdlib 3.13.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
你知道为什么吗?我的 psql 凭据是正确的...
【问题讨论】:
-
您的主机指定是否正确(例如,
localhost)?您如何验证与 PostGres 的连接?通过psql还是通过GUI? -
我重新安装了 Phoenix 并且可以正常工作
-
这是在 Elixir 论坛上交叉发布的,并有回复:elixirforum.com/t/mix-ecto-create-fails/36844