ssh'ing in db instance to run pg_dump returns error

Hi, newbie question:

I wanted to dump the db (pg_dump), only to get this error:

pg_dump: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
	Is the server running locally and accepting connections on that socket?

here’s what i did to get that:

  • fly ssh console --app myapp-db --config ./myapp-staging.toml
  • created postgres container (i only access postgres with containers)
  • ran bash inside running container
  • ran these 2 commands:
    • pg_dump -U postgres -d myapp_staging > /path/to/filename.sql AND
    • pg_dump -d postgres://postgres:password@localhost:5432/databasename > /path/to/filename.sql

oh, nvm i ended up installing libpq locally.

1 Like