Thread: psql and passwd

psql and passwd

From
Alex Dovlecel
Date:
Hello all
I create a bash file that
1)drops the database
2)create the database again
3)call the psql on initdb.sql file (wich creates the tables and stuff)
4)call the psql on populatedb.sql file

It works fine... but there is something that I don't like
Step 1) ask me the account passwd
Step 2) ask me the account passwd
Step 3) ask me the account passwd
Step 4) ask me the account passwd

So I have to type the passwd 4 times... for each command!!!

Is there any way around this: to send the password from command line as a
parameter?

I am using bash so there might be someone who can tell me if I can use some
pipe mechanisms to achieve this ?

Tx
dovle

Re: psql and passwd

From
Dave Cramer
Date:
This isn't a jdbc question but I will answer it anyway

use -U postgres in your scripts as the user or make yourself a super
user and it won't ask you for a password

Dave
On Tue, 2002-11-19 at 07:34, Alex Dovlecel wrote:
> Hello all
> I create a bash file that
> 1)drops the database
> 2)create the database again
> 3)call the psql on initdb.sql file (wich creates the tables and stuff)
> 4)call the psql on populatedb.sql file
>
> It works fine... but there is something that I don't like
> Step 1) ask me the account passwd
> Step 2) ask me the account passwd
> Step 3) ask me the account passwd
> Step 4) ask me the account passwd
>
> So I have to type the passwd 4 times... for each command!!!
>
> Is there any way around this: to send the password from command line as a
> parameter?
>
> I am using bash so there might be someone who can tell me if I can use some
> pipe mechanisms to achieve this ?
>
> Tx
> dovle
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
--
Dave Cramer <Dave@micro-automation.net>