Re: Unable to execute pg_dump

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Joseph Maruca <joseph(dot)maruca(at)masimo(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Unable to execute pg_dump
Date: 2020-06-15 04:54:57
Message-ID: CAKFQuwbDh3ow0FbMrkNqgKu3mxmEr0o0pwRkaxhcoYtuScYmYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sunday, June 14, 2020, Joseph Maruca <joseph(dot)maruca(at)masimo(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-06-15 05:00:02 Re: Unable to execute pg_dump
Previous Message Joseph Maruca 2020-06-15 04:38:22 Unable to execute pg_dump