Environment variable $PGUSER does NOT take effect with Postgresql client?
0
votes
1
answer
441
views
For many years I have used to use the environment variable
$PGUSER
when I work with client tools such as psql/pg_dump/pg_restore.
Recently I build up a new PG13 server, the env var $PGUSER
does **NOT** take effect, when I try to use the client tools on a terminal of the server.
I get message like this:
> leon@mamba:~$ echo $PGUSER
>
> postgres
>
> leon@mamba:~$ psql
>
> psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed:
>
> FATAL: role "leon" does not exist
If I use the tools on a terminal of another physical computer, the env var takes effect normally.
Of course, the var has been set on both machines.
My pg_hba.conf:
> \# TYPE DATABASE USER ADDRESS METHOD
>
> host all all 127.0.0.1/32 trust
>
> host all all 192.168.x.x/16 md5
>
> \# IPv6 local connections:
>
> host all all ::1/128 trust
Asked by Leon
(411 rep)
Oct 21, 2024, 07:22 AM
Last activity: Oct 22, 2024, 01:54 PM
Last activity: Oct 22, 2024, 01:54 PM