Postgres Osm2pgsql 错误:角色不存在
我一直在设置 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您没有指定 -U|--username 开关,因此 osm2pgsql 从终端获取当前用户名(除非您设置 PGUSER 环境变量)。错误消息看起来非常清楚,告诉您的数据库集群中不存在名为
myUsername
的角色。请注意:将产生两个不同角色:
You didn't specify
-U|--username
switch, soosm2pgsql
gets current username from terminal (unless you setPGUSER
environment variable). Error message looks very clear, telling that role namedmyUsername
does not exist in your database cluser. Note that:will produce two different roles:
我知道这是一个老问题,但 OSM 中的情况已经发生了变化,这个答案似乎位于 Google 搜索的顶部
使用这个:
例如
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:
for example