Re: after initdb - Re: How to CREATEDB in commandline with no prompt for password

Поиск
Список
Период
Сортировка
От Shane Ambler
Тема Re: after initdb - Re: How to CREATEDB in commandline with no prompt for password
Дата
Msg-id 47CE16D7.4050700@Sheeky.Biz
обсуждение исходный текст
Ответ на after initdb - Re: How to CREATEDB in commandline with no prompt for password  (bwnabble <bwiese@cotse.com>)
Список pgsql-admin
bwnabble wrote:
>
> Did you have your METHODs set to "trust" in your "pg_hba.conf" file (in the
> $PGDATA directory)?
>
> My question is, similar to yours, is there a way to:
> 1) run "initdb" as user "postgres" on an empty $PGDATA directory to start
> from scratch
> 2) change the METHODs in "$PGDATA/pg_hba.conf" from "trust" -> "password"
> 3) start the postgresql server
> 4) run "createdb mydb" with no prompt for a password? (as user root or
> postgres?)

1 & 3 are standard CLI commands that can be scripted as well as anything
else you do on your system. (3 would be scripted already so that pg
starts with the system)

2 is a simple editing of a file that gets performed once after step 1.

You would only do steps 1-3 once on a system (maybe a few more if you
are repeating it as a learning experience)

cratedb on the other hand may be something that gets run every time a
new user gets added to your server.

If you are looking to automate step 4 then you bypass the password
prompt with a trust entry that is only for the machine or user that will
perform the operation. The other option is using a .pgpass file.


If you are at a point where you want to automate setting up a large
number of new systems and you don't know enough about *nix systems to
create these scripts yourself then you should take a few steps back and
learn more about *nix sysadmin before you move on.



--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

В списке pgsql-admin по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: GRANT ALL ON recursive for all tables in my scheme?
Следующее
От:
Дата:
Сообщение: ident authentication problem