1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Rep Power

    Pg_restore - connection to DB failed, boing!

    hey all,

    having a problem.

    have postgreSQL 9.2 running locally on my mac, along with a resin web server.

    created a DB in pgadmin.
    trying to restore a DB to the one i created.

    getting the following error

    alan:bin alan$ sudo pg_restore -O -U athena_dbu -d athenaDB /var/tmp/BLANK_DB_US_3.3.5.dmp

    pg_restore: [archiver (db)] connection to database "athenaDB" 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"?

    what ive tried
    - putting file in different directories
    - stop and started the postgres daemon
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Usually Japan when not on contract
    Rep Power
    Either the server daemon isn't running, its running, but on a different port or socket than pg_restore is expecting (default is 5432) or you have an access setting blocking connections from pg_restore to the server's socket/port. I'm not sure about the mac environment -- but an easy way to test is to see if you can use psql to connect to the server from the command line. Most likely you will get the same error message.

    Usually its one of four things:
    • A file permissions thing: Only user X has access to the socket
    • A firewall thing: Arbitrary connection rule X prevents connection from psql/pg_restore/pg_dump to port 5432 but not from Arbitrary GUI tool Y
    • An authentication settings issue in pg_hba.conf: The pgadmin installation you're using authenticates as its own unix user in a way postgres has been told to expect (this is different from the postgres role)
    • The server isn't actually running: Its being started in the background by a not-so-smart "smart" event handler when you click some icon, but not when core utilities are trying to reach it (the icon event being unaware of how stuff really works).

    Hope this at least gives you some places to start troubleshooting. The best thing to do is usually to check the Postgres docs before doing anything else. A half hour skimming the configuration and authentication options for the server is usually enlightening enough that whatever problem you're having becomes obvious.

IMN logo majestic logo threadwatch logo seochat tools logo