Обсуждение: Password issue

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

Password issue

От
Mahmoud
Дата:
Hi all
I am trying to create a database by passing arguments to createdb.exe
but createdb always asks me about the password although I passed  -W 123
to it.

How can I override password request?

PS
This my test for creating the database
createdb.exe -U postgres -W 123 -O admin -e test

Cheers.

Re: Password issue

От
Ashesh Vashi
Дата:
'-W' option is there to prompt the password.

Use PGPASSWORD environment variable.
http://www.postgresql.org/docs/8.3/static/libpq-envars.html

createdb creates a PostgreSQL database.

Usage:
  createdb [OPTION]... [DBNAME] [DESCRIPTION]

Options:
  -D, --tablespace=TABLESPACE  default tablespace for the database
  -e, --echo                   show the commands being sent to the server
  -E, --encoding=ENCODING      encoding for the database
  -l, --locale=LOCALE          locale settings for the database
      --lc-collate=LOCALE      LC_COLLATE setting for the database
      --lc-ctype=LOCALE        LC_CTYPE setting for the database
  -O, --owner=OWNER            database user to own the new database
  -T, --template=TEMPLATE      template database to copy
  --help                       show this help, then exit
  --version                    output version information, then exit

Connection options:
  -h, --host=HOSTNAME          database server host or socket directory
  -p, --port=PORT              database server port
  -U, --username=USERNAME      user name to connect as
  -w, --no-password            never prompt for password
  -W, --password               force password prompt

On Thu, May 19, 2011 at 8:23 PM, Mahmoud <mhhasan@gmx.com> wrote:
Hi all
I am trying to create a database by passing arguments to createdb.exe but createdb always asks me about the password although I passed  -W 123 to it.

How can I override password request?

PS
This my test for creating the database
createdb.exe -U postgres -W 123 -O admin -e test

Cheers.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA:
Enterprise PostgreSQL Company

 

http://www.linkedin.com/in/asheshvashi


Re: Password issue

От
hubert depesz lubaczewski
Дата:
On Thu, May 19, 2011 at 05:53:11PM +0300, Mahmoud wrote:
> Hi all
> I am trying to create a database by passing arguments to
> createdb.exe but createdb always asks me about the password although
> I passed  -W 123 to it.

please check docs for createdb
http://www.postgresql.org/docs/current/interactive/app-createdb.html

-W is not used to provide password at command line.

for providing password check
http://www.postgresql.org/docs/current/interactive/libpq-envars.html
and/or
http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

Re: Password issue

От
"Albe Laurenz"
Дата:
Mahmoud wrote:
> I am trying to create a database by passing arguments to createdb.exe
> but createdb always asks me about the password although I passed  -W 123
> to it.
>
> How can I override password request?
>
> PS
> This my test for creating the database
> createdb.exe -U postgres -W 123 -O admin -e test

As has been mentioned, -W takes no arguments and prompts you for a password.

If you want a password, but don't want the prompt (e.g. because you are
writing a script), you could:

- Not use -W, then the superuser will have no password initially.
- Start the server.
- Using "trust" authentication, connect to a database.
- Issue "ALTER ROLE ... PASSWORD '...'" to set a password.

Yours,
Laurenz Albe