How to pass the password for login in psql

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to pass the password for login in psql

Josef Springer
Hi,

i want to use psql using the --username option. But i do not find an
option to pass the password. I want to use psql in a batch, so i want to
automate it.

Best Regards,
Josef Springer




---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq
Reply | Threaded
Open this post in threaded view
|

Re: How to pass the password for login in psql

Oisin Glynn
BAT FILE SHOULD CONTAIN

set PGPASSWORD=postgres
"psql.exe" MYDATABASE -U postgres -f mysqlfile.sql


Oisin
----- Original Message -----
From: "Josef Springer" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, July 19, 2005 1:26 PM
Subject: [GENERAL] How to pass the password for login in psql


> Hi,
>
> i want to use psql using the --username option. But i do not find an
> option to pass the password. I want to use psql in a batch, so i want to
> automate it.
>
> Best Regards,
> Josef Springer
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faq
>
>


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq
Reply | Threaded
Open this post in threaded view
|

Re: How to pass the password for login in psql

Tom Lane-2
In reply to this post by Josef Springer
Josef Springer <[hidden email]> writes:
> i want to use psql using the --username option. But i do not find an
> option to pass the password.

There are very good reasons for that.

> I want to use psql in a batch, so i want to automate it.

Consider using a ~/.pgpass file.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq
Reply | Threaded
Open this post in threaded view
|

Re: How to pass the password for login in psql

Scott Marlowe
In reply to this post by Oisin Glynn
FYI, this is deprecated in favor of a .pgpass file.

See:

http://www.postgresql.org/docs/8.0/static/libpq-pgpass.html

On Tue, 2005-07-19 at 13:01, Oisin Glynn wrote:

> BAT FILE SHOULD CONTAIN
>
> set PGPASSWORD=postgres
> "psql.exe" MYDATABASE -U postgres -f mysqlfile.sql
>
>
> Oisin
> ----- Original Message -----
> From: "Josef Springer" <[hidden email]>
> To: <[hidden email]>
> Sent: Tuesday, July 19, 2005 1:26 PM
> Subject: [GENERAL] How to pass the password for login in psql
>
>
> > Hi,
> >
> > i want to use psql using the --username option. But i do not find an
> > option to pass the password. I want to use psql in a batch, so i want to
> > automate it.
> >
> > Best Regards,
> > Josef Springer
> >
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: Have you checked our extensive FAQ?
> >
> >               http://www.postgresql.org/docs/faq
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings