Create database without entering password at command line

Started by Nathan Thatcheralmost 18 years ago2 messagesgeneral
Jump to latest
#1Nathan Thatcher
n8thatcher@gmail.com

I am trying to automatically create a database right after installing
postgres. I launch the silent install (Windows) from my own executable
and once it is done I need to create a database, tables, etc. I am
trying to find a way to do this without having to explicitly enter the
password in at the command prompt. What is the best way to do this?

Thanks,
Nate

#2Chris
dmagick@gmail.com
In reply to: Nathan Thatcher (#1)
Re: Create database without entering password at command line

Nathan Thatcher wrote:

I am trying to automatically create a database right after installing
postgres. I launch the silent install (Windows) from my own executable
and once it is done I need to create a database, tables, etc. I am
trying to find a way to do this without having to explicitly enter the
password in at the command prompt. What is the best way to do this?

You could use a pgpass file:

http://www.postgresql.org/docs/current/static/libpq-pgpass.html

--
Postgresql & php tutorials
http://www.designmagick.com/