gpt4 book ai didi

postgresql - Phoenix 无法连接到 Heroku 的 PostgreSQL 服务器

转载 作者:行者123 更新时间:2023-12-04 01:56:34 25 4
gpt4 key购买 nike

这是我在设置为乱七八糟的原始 Phoenix 应用程序上看到的错误:

[error] Postgrex.Protocol (#PID<0.362.0>) failed to connect: ** (Postgrex.Error) FATAL 28000 (invalid_authorization_specification): no pg_hba.conf entry for host "24.25.201.68", user "koilqmnaakvfjg", database "dc245o0vlbprf7", SSL off

这是我的config/dev.exs:

# Configure your database
config :hello, Hello.Repo,
adapter: Ecto.Adapters.Postgres,
username: "koilqmnaakvfjg",
password: "somepass",
database: "dc245o0vlbprf7",
hostname: "ec2-54-243-54-6.compute-1.amazonaws.com",
pool_size: 10

我缺少一些简单的东西?

编辑:

我的 pg_hba.conf 文件如下所示:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host all all 0.0.0.0/0 md5
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust

最佳答案

您需要将 ssl 参数设置为 true,如果问题仍然存在,请修改 pg_hba.conf 文件。

解决方法:

# Configure your database
config :hello, Hello.Repo,
adapter: Ecto.Adapters.Postgres,
username: "koilqmnaakvfjg",
password: "somepass",
database: "dc245o0vlbprf7",
hostname: "ec2-54-243-54-6.compute-1.amazonaws.com",
pool_size: 10,
ssl: true

希望对你有帮助:D

告诉我进展如何;

祝你好运;

关于postgresql - Phoenix 无法连接到 Heroku 的 PostgreSQL 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50111337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com