Postgres Osm2pgsql 错误:角色不存在

发布于 2024-12-01 08:37:06 字数 243 浏览 2 评论 0原文

我一直在设置 osm2pgsql 将 .osm 文件转换为可在 Postgres 中使用。 我现在尝试了以下语句:

osm2pgsql --merc -d sa sa.osm

我收到以下错误: “连接到数据库失败:致命:角色“myUsername”不存在

我已经阅读了有关使用 Postgres 时通常会遇到的这种错误的信息。我在 Postgres 中创建了一个新角色,但错误仍然存​​在。

有什么建议吗?

I've been setting up osm2pgsql to convert .osm files to be usable in Postgres.
I have now tried the following statement:

osm2pgsql --merc -d sa sa.osm

I am given the following error:
"Connection to database failed: FATAL: role "myUsername" does not exist

I have read up about this kind of error which is usually run into when using Postgres. I have created a new role in Postgres but still the error persists.

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我很坚强 2024-12-08 08:37:06

您没有指定 -U|--username 开关,因此 osm2pgsql 从终端获取当前用户名(除非您设置 PGUSER 环境变量)。错误消息看起来非常清楚,告诉您的数据库集群中不存在名为 myUsername 的角色。请注意:

CREATE ROLE myUsername LOGIN;    -- creating role myusername
CREATE ROLE "myUsername" LOGIN;  -- creating role myUsername

将产生两个不同角色:

SELECT rolname FROM pg_roles;
  rolname   
------------
 postgres
 myUsername
 myusername
(3 rows)

You didn't specify -U|--username switch, so osm2pgsql gets current username from terminal (unless you set PGUSER environment variable). Error message looks very clear, telling that role named myUsername does not exist in your database cluser. Note that:

CREATE ROLE myUsername LOGIN;    -- creating role myusername
CREATE ROLE "myUsername" LOGIN;  -- creating role myUsername

will produce two different roles:

SELECT rolname FROM pg_roles;
  rolname   
------------
 postgres
 myUsername
 myusername
(3 rows)
绮筵 2024-12-08 08:37:06

我知道这是一个老问题,但 OSM 中的情况已经发生了变化,这个答案似乎位于 Google 搜索的顶部

使用这个:

/usr/bin/install-postgis-osm-user.sh the-database-here your-username-here

例如

/usr/bin/install-postgis-osm-user.sh gis barrythefish

I know this is an old question but things have changed in OSM and this answer appears to be at the top of a Google search

Use this:

/usr/bin/install-postgis-osm-user.sh the-database-here your-username-here

for example

/usr/bin/install-postgis-osm-user.sh gis barrythefish
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文