LINE COMMAND

Поиск
Список
Период
Сортировка
Искать

LINE COMMAND

От:
Felipe Lopes <felipelopess@gmail.com>
Дата:
I would like to run a line command (psql) with the supplied password without
pausing the command, but this option is not available:

psql --username=3Droot --password=3Droot my_bd < "script.sql"

The pass only can be informed after execution, pausing the command:

psql --username=3Droot --password my_bd

Re: LINE COMMAND

От:
Mike Fowler <mike@mlfowler.com>
Дата:
On 16/08/10 15:03, Felipe Lopes wrote:
> I would like to run a line command (psql) with the supplied password 
> without pausing the command, but this option is not available:
> psql --username=root --password=root my_bd < "script.sql"
> The pass only can be informed after execution, pausing the command:
> psql --username=root --password my_bd Senha para usußrio root: ****
>
> Thanks.
>
> -- 
> Felipe L.

Yes, the --password option forces the server to request password 
authentication. What you need to do is create a password file and 
specify --no-password on your psql command. See:

http://www.postgresql.org/docs/8.4/interactive/libpq-pgpass.html

Regards,

-- 
Mike Fowler
Registered Linux user: 379787

Re: LINE COMMAND

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Felipe Lopes  writes:
> I would like to run a line command (psql) with the supplied password without
> pausing the command, but this option is not available:

> psql --username=root --password=root my_bd < "script.sql"

This is intentionally not supported.  If it were supported it would be
insecure.  On most operating systems, every process in the machine can
see whatever is on the command line of every other process ... including
your password, if you were doing something like the above.

The recommended solution if you don't want to key in the password
separately is to use a .pgpass file.  See
http://www.postgresql.org/docs/8.4/static/libpq-pgpass.html

			regards, tom lane

Re: LINE COMMAND

От:
Felipe Lopes <felipelopess@gmail.com>
Дата:
Great!!!!!

Thanks a lot!

2010/8/16 Mike Fowler 

>  On 16/08/10 15:03, Felipe Lopes wrote:
>
>> I would like to run a line command (psql) with the supplied password
>> without pausing the command, but this option is not available:
>> psql --username=3Droot --password=3Droot my_bd < "script.sql"
>> The pass only can be informed after execution, pausing the command:
>> psql --username=3Droot --password my_bd> Senha para usu=DFrio root: ****
>>
>> Thanks.
>>
>> --
>> Felipe L.
>>
>
> Yes, the --password option forces the server to request password
> authentication. What you need to do is create a password file and specify
> --no-password on your psql command. See:
>
> http://www.postgresql.org/docs/8.4/interactive/libpq-pgpass.html
>
> Regards,
>
> --
> Mike Fowler
> Registered Linux user: 379787
>
>


--=20
Felipe L.
FAQ