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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-admin

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux