Elixir Phoenix ecto.create失败

时间:2020-03-09 10:12:45

标签: postgresql elixir phoenix-framework ecto

我正在关注https://phoenixframework.readme.io/docs/up-and-running上的Phoenix Up&Running指南 当我尝试使用ecto创建数据库(Postgresql)时,出现以下错误

mix ecto.create
17:55:35.631 [error] GenServer #PID<0.215.0> terminating
** (RuntimeError) Connect raised a CaseClauseError error. The exception details are hidden, as they may contain sensitive data such
as database credentials.

    (postgrex 0.12.2) lib/postgrex/utils.ex:40: Postgrex.Utils.parse_version/1
    (postgrex 0.12.2) lib/postgrex/protocol.ex:497: Postgrex.Protocol.bootstrap_send/4
    (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.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

Last message: nil 

State: Postgrex.Protocol

** (Mix) The database for HelloPhoenix.Repo couldn't be created: an exception was raised:
    ** (RuntimeError) Connect raised a CaseClauseError error. The exception details are hidden, as they may contain sensitive data such
as database credentials.

        (postgrex 0.12.2) lib/postgrex/utils.ex:40: Postgrex.Utils.parse_version/1
        (postgrex 0.12.2) lib/postgrex/protocol.ex:497: Postgrex.Protocol.bootstrap_send/4
        (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.11.2) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

我发现的唯一建议是更新Postgrex。我运行了mix deps.update postgrex,但并没有解决。

最后,我检查了config / dev.exs并将用户名/密码设置为“ postgres”。我使用PgAdmin3确认这是有效的登录名。

所以我现在被困住了。

Ubuntu 19.10

postgres (PostgreSQL) 11.7 (Ubuntu 11.7-0ubuntu0.19.10.1)
 installed from Ubuntu repo via apt-get

1 个答案:

答案 0 :(得分:0)

的是什么版本 Postgress和postgrex?

postgrex支持PostgreSQL 8.4、9.0-9.6和更高版本(8.4不支持hstore)