【问题标题】:Elixir Phoenix ecto.create failElixir Phoenix ecto.create 失败
【发布时间】:2020-06-21 05:09:31
【问题描述】:

我正在关注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

【问题讨论】:

    标签: postgresql elixir phoenix-framework ecto


    【解决方案1】:

    有哪些版本 Postgress 和 postgrex ?

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

    【讨论】:

    • postgres (PostgreSQL) 11.7 (Ubuntu 11.7-0ubuntu0.19.10.1)
    猜你喜欢
    • 1970-01-01
    • 2018-04-21
    • 2016-12-09
    • 1970-01-01
    • 2016-12-24
    • 2018-05-22
    • 2017-02-05
    • 1970-01-01
    • 2023-03-03
    相关资源
    最近更新 更多