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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With