On Sunday, June 14, 2020, Joseph Maruca <joseph.mar...@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.

Reply via email to