我一直在設置osm2pgsql來將.osm文件轉換爲可在Postgres中使用。 我現在已經嘗試了以下聲明:Postgres Osm2pgsql錯誤:角色不存在
osm2pgsql --merc -d SA sa.osm
我提示以下錯誤: 「連接到數據庫失敗:FATAL:角色‘名爲myUsername’不存在
我對這種錯誤通常是運行使用Postgres的時候,我已經創造了Postgres的一個新的角色,但仍是錯誤持續到閱讀起來。
有什麼建議?
我一直在設置osm2pgsql來將.osm文件轉換爲可在Postgres中使用。 我現在已經嘗試了以下聲明:Postgres Osm2pgsql錯誤:角色不存在
osm2pgsql --merc -d SA sa.osm
我提示以下錯誤: 「連接到數據庫失敗:FATAL:角色‘名爲myUsername’不存在
我對這種錯誤通常是運行使用Postgres的時候,我已經創造了Postgres的一個新的角色,但仍是錯誤持續到閱讀起來。
有什麼建議?
您沒有指定-U|--username
開關,所以osm2pgsql
從終端獲取當前用戶名(除非您設置了PGUSER
環境變量)。錯誤消息看起來非常清楚,告訴您名爲myUsername
的角色不存在於您的數據庫cluser中。需要注意的是:
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)
我知道這是一個老問題,但事情已經在OSM改變,這個答案似乎是在谷歌的頂部搜索
使用此:
/usr/bin/install-postgis-osm-user.sh the-database-here your-username-here
爲例
/usr/bin/install-postgis-osm-user.sh gis barrythefish
謝謝!用戶名開關起作用! – nix