Re: Specifying psql password on command line

From: Anand Raman <araman(at)india-today(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Specifying psql password on command line
Date: 2001-06-06 04:49:11
Message-ID: 20010606101911.A2763@india-today.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

preety simple.. In ur shell script use

psql -h localhost ur_db -U ur_user_name <<EOF
ur_passwd
ur_sql_script.sql
EOF

is this is too much of a botheration u can set the environment variables
PGUSER and PGPASSWD

Hope this helps
Anand

On Tue, Jun 05, 2001 at 05:59:28PM -0700, Tauren Mills wrote:
>I've read the documentation for the psql commands as well as the createdb
>and dropdb commands. It looks like there is no way to specify the password
>on the command line. The password is always provided in the form of a stdin
>prompt.
>
>This makes it very difficult to use the commands from a shell script or a
>cron job. The same with redirecting to/from a file or piping it
>somewhere. It seems like there must be some way to specify the password on
>the command line.
>
>Am I missing something? Any workarounds?
>
>Thanks,
>Tauren
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Igor 2001-06-06 05:12:16 Re[2]: How to Alter tables with ARRAY? Help PLease
Previous Message Neil Conway 2001-06-06 03:45:06 Re: Sequences in transaction context