Postgres Osm2pgsql Error: role does not exist
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?
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)
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
精彩评论