I have a local postgres server running (on ubuntu linux). It is listening via a socket file:
$ ls -la /var/run/postgresql/
total 8
drwxrwsrwx 2 postgres postgres 100 2011-04-15 19:06 .
drwxr-xr-x 26 root root 1100 2011-04-15 19:12 ..
-rw------- 1 postgres postgres 5 2011-04-15 19:06 8.4-main.pid
srwxrwxrwx 1 postgres postgres 0 2011-04-15 19:06 .s.PGSQL.5433
-rw------- 1 postgres postgres 34 2011-04-15 19:06 .s.PGSQL.5433.lock
I can connect to the server fine on the command line:
$ psql -d gis -U rory
psql (8.4.7)
Type "help" for help.
gis=# \q
$ psql -d gis
psql (8.4.7)
Type "help" for help.
gis=# \q
I am trying to use osm2pgsql, an application from the OpenStreetMap project, which imports data into a pgsql database.
However the error I get is:
$ ./osm2pgsql/osm2pgsql -m -d gis -U rory ../data.osm.bz2
osm2pgsql SVN version 0.70.5
Connection to database failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
Noticably, it is trying to use the socket file .s.PGSQL.5432
, which doesn't exist, whereas the actual socket filename is .s.PGSQL.5433
, the filenames are almost exactly the same.
Why is it using the wrong filename, and how do I make it use the correct one?