我一直在设置osm2pgsql来将.osm文件转换为在Postgres中可用。我现在尝试了以下语句:
osm2pgsql --merc -d sa sa.osm
我收到以下错误:“连接到数据库失败:致命:角色"myUsername”不存在
我读过关于这种错误的资料,在使用Postgres时通常会遇到这种错误。我在Postgres中创建了一个新角色,但错误仍然存在。
有什么建议吗?
发布于 2011-08-26 08:22:36
您没有指定-U|--username开关,因此osm2pgsql从终端获取当前用户名(除非您设置了PGUSER环境变量)。错误消息看起来非常清楚,告诉您的数据库cluser中不存在名为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)发布于 2014-04-21 02:27:17
我知道这是一个老问题,但OSM中的情况已经发生了变化,这个答案似乎在谷歌搜索的顶部
使用以下命令:
/usr/bin/install-postgis-osm-user.sh the-database-here your-username-here例如
/usr/bin/install-postgis-osm-user.sh gis barrythefishhttps://stackoverflow.com/questions/7196872
复制相似问题