Thread: how to set password while loging into database

how to set password while loging into database

From
"J Roy"
Date:
Hi,

Actually i installed postgresql 8.0 on my windows system. After that i want
to connect database through command prompt so i type like this
c:\programfiles\postgresql\8.0\bin>psql -U postgres -d mydb
when i typed the above command then it asking password, when i give password
it is able connect otherwise it won't
Here what my problem is in psql command i want to give password after user
name, it should not ask me onceagain password, so is there any option to
give password within psql command. You can ask me why i am asking like this
if i want to run a batch file then i can not enter for each every command
the password, so pls help me and tell me how to set password to commands
like psql and createdb and other commands. Pls help it's very urgent for me.

My email id is jith_n@yahoo.com

Thanks,
J R





Re: how to set password while loging into database

From
"Magnus Hagander"
Date:
You can put your password in pgpass.conf, see
http://www.postgresql.org/docs/8.0/static/libpq-pgpass.html. It will
affect all libpq applications though, and not just psql.

You can also put it in the PGPASSWORD environment variable with SET, but
it's deprecated for security reasons (see
http://www.postgresql.org/docs/8.0/static/libpq-envars.html)


//Magnus

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of J Roy
> Sent: Saturday, January 22, 2005 2:43 AM
> To: pgsql-hackers@postgresql.org
> Subject: [HACKERS] how to set password while loging into database
>
> Hi,
>
> Actually i installed postgresql 8.0 on my windows system.
> After that i want to connect database through command prompt
> so i type like this c:\programfiles\postgresql\8.0\bin>psql
> -U postgres -d mydb when i typed the above command then it
> asking password, when i give password it is able connect
> otherwise it won't Here what my problem is in psql command i
> want to give password after user name, it should not ask me
> onceagain password, so is there any option to give password
> within psql command. You can ask me why i am asking like this
> if i want to run a batch file then i can not enter for each
> every command the password, so pls help me and tell me how to
> set password to commands like psql and createdb and other
> commands. Pls help it's very urgent for me.
>
> My email id is jith_n@yahoo.com
>
> Thanks,
> J R
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index
> scan if your
>       joining column's datatypes do not match
>