Re: Unable to execute pg_dump - Mailing list pgsql-general

From David G. Johnston
Subject Re: Unable to execute pg_dump
Date
Msg-id CAKFQuwbDh3ow0FbMrkNqgKu3mxmEr0o0pwRkaxhcoYtuScYmYw@mail.gmail.com
Whole thread Raw
In response to Unable to execute pg_dump  (Joseph Maruca <joseph.maruca@masimo.com>)
List pgsql-general
On Sunday, June 14, 2020, Joseph Maruca <joseph.maruca@masimo.com> wrote:

'''sudo -u postgres -H --psql -pxxxxx -d db_name'''

If I enter the following syntax from the RHEL command line:

'''sudo su postgres'''

I end up in the bash-4.1 shell. When executing the following command from within the shell: bash-4.1$ pg_dump db_name > /tmp/my_database.sql I am presented with the following error:

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

Not a RHEL user but...

For psql you specify the port but not for pg_dump.
For psql you seem to be switching to the postgres user’s environment but don’t do that for pg_dump.

In short it seems like you need to trace down your O/S environment differences when each command is run.

David J.

pgsql-general by date:

Previous
From: Joseph Maruca
Date:
Subject: Unable to execute pg_dump
Next
From: Tom Lane
Date:
Subject: Re: Unable to execute pg_dump