Pregunta

Easy points for anyone but me. I am trying to use pg_dump. I am running Mac OSx, postgres.app, 9.2, and I want to back up my db. I tried the other solutions for the same problem, but no success. The postgres.app is running on 5432 as far as I can tell. I ran the command below from a random directory, and from my data directory, no luck.

Command tried:

 $ pg_dump pdbt > pdbt.sql

Error:

pg_dump: [archiver (db)] connection to database "pdbt" failed: could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
¿Fue útil?

Solución

  • Could be an OSX issue (wrong location of built-in unix-domain socket // version kludge). Does psql pdbt -l work ?
  • also try with -h dirname eg pg_dump -h /tmp/ pdbt > pdbt.sql
  • Does psql -h localhost pdbt -l work ?
  • then: pg_dump -h localhost pdbt will probably work, too.
  • To find out of multiple version for pg_dump co-exist, you could try: find / -name pg_dump -ls , after that you can try the various versions using the complete pathname (eg /usr/bin/pg_dump -h localhost or /usr/local/bin/pg_dump -h localhost or whatever find found)
  • Presumably the older(wrong) version is first in the path.

In most cases some OSX installion process left some old binaries installed (one release of OSX had different buit-in paths for the unix domain socket). Also: try to check for differnt versions of the binaries (with the wrong one first in the PATH)

Related: (psql instead of pg_dump, but probably the same OSX issue)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top