I can't get osm2pgsql to work on Windows, though I have the same import process working on wsl. I have installed Windows postgresql (13.2.2) and osm2pgsql (1.4.2) using defaults mostly; pgadmin4 can see the postgresql databases and I can talk to postgres from psql (using defaults of localhost, postgres, 5433, postgres and the password). I am running osm2pgsql with
and have tried every combination of parameters:
I never get asked for a password, ie, the -W appears not to behave as documented. Is this a bug? Is there a workround? Or have I just got it wrong (very possible!) asked 14 May '21, 10:32 ANDREW |
Postgres authentication is often a bit fiddly even on Unix. You are right, it sounds like the -W does not behave as advertised. One thing that might help as a workaround is creating a database user with the same name as your Windows account (and making that account the owner of the gis database OR give that account postgres superuser rights). The pg_hba.conf which controls authentication should normally let you in without a password if you are the same user on the system that you try to connect to in postgres. Although I am worried by the "fe_sendauth: no password supplied" which, I believe, is issued by the client library and not the server, which would then of course mean that password-less login will never work because the client doesn't even try to connect. answered 14 May '21, 11:11 Frederik Ramm ♦ Thanks, but as you suspected. Creating a database user with the same name as the Windows user results in the same behaviour: without the -W option, I get "fe_sendauth: no password supplied" and with the -W option: "password authentication failed" and without any chance of actually entering a password.
(14 May '21, 15:05)
ANDREW
|
First: You should probably not use the "postgres" database user for day-to-day work, because it has superuser privileges. I don't know why the "-W" doesn't work in your case. I just checked on Linux and it does work there. It might well be that it doesn't work on Windows for some reason, but none of the developers have a Windows machine to check. Instead of the command line options you can use environment variables to specify how to access the database. See the docs here: https://www.postgresql.org/docs/current/libpq-envars.html answered 14 May '21, 14:20 Jochen Topf Thank you, using environment variables does get round the problem.
(14 May '21, 15:40)
ANDREW
|