From: Shane Ambler <pgsql@Sheeky.Biz>
To: bwnabble <bwiese@cotse.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: after initdb - Re: How to CREATEDB in commandline with no prompt for password
Date: Wed, 05 Mar 2008 14:13:19 +1030
Message-ID: <47CE16D7.4050700@Sheeky.Biz> (raw)
In-Reply-To: <15817886.post@talk.nabble.com>
References: <238696420802192330g69e3c447jeadd1d3d31506eda@mail.gmail.com>
<47BBDF78.7070801@Sheeky.Biz>
<238696420802200115m522cfd11h2f37d87845c2d6e0@mail.gmail.com>
<238696420802200219y7bfd4269u498dd1fe0b80c2cc@mail.gmail.com>
<238696420802200311y40a93a38jbd601e280d2fb860@mail.gmail.com>
<15817886.post@talk.nabble.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: pgsql@Sheeky.Biz, bwiese@cotse.com
Subject: Re: after initdb - Re: How to CREATEDB in commandline with no prompt for password
In-Reply-To: <47CE16D7.4050700@Sheeky.Biz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox