gpt4 book ai didi

postgresql - 无法连接到 azure postgresql - 用户名应采用 <用户名@主机名> 格式

转载 作者:行者123 更新时间:2023-11-29 13:15:36 25 4
gpt4 key购买 nike

我正在尝试使用 azure PostgreSQL 进行 CKAN (ckan.org)CKAN 正在使用 http://www.sqlalchemy.org/用于数据库连接。

连接字符串如下所示:

engine = create_engine('postgresql://scott:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="94e0fdf3f1e6d4f9edfcfbe7e0bae4fbe7e0f3e6f1e7baf0f5e0f5f6f5e7f1baf5eee1e6f1baf7fbf9" rel="noreferrer noopener nofollow">[email protected]</a>:5432/mydatabase')

语法为:

postgresql://username:password@hostname:5432/databasename

当尝试连接到 azure postgresql 时,我收到此错误:

FATAL: Invalid Username specified. Please check the Username and retry connection. The Username should be in username@hostname format.

如果我尝试使用这样的用户名格式:

postgresql://scott@myhost:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="32465b555740725f4b5a5d41461c425d4146554057411c56534653505341571c53484740571c515d5f" rel="noreferrer noopener nofollow">[email protected]</a>:5432/mydatabase

然后我得到:

invalid port number: "[email protected]:5432"

有人解决这个问题了吗?

最佳答案

端口号无效是由用户名中的@引起的。

连接 URL 应如下所示:

postgresql://scott%40myhost:<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="512538363423113c28393e22257f213e2225362334227f35302530333022347f302b2423347f323e3c" rel="noreferrer noopener nofollow">[email protected]</a>:5432/mydatabase

关于postgresql - 无法连接到 azure postgresql - 用户名应采用 <用户名@主机名> 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49521984/

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