Few days back I was trying to create database in a batch job using createdb.exe and I encountered this problem createdb.exe prompts for password and there is no way of passing password from command line as an argument.
I tried to find out how to do this but in vein there is no way you can pass password as an command line argument; than after looking around for sometime and googling I found two ways of doing it
- Setting up PGPASSWORD environment variable : This method is not preferable as it’s insecure more for further details read this
- Setting up password in pgpass.conf : The file is to be located
%APPDATA%\postgresql\pgpass.conf
File has the following format
Each of the first four fields may be a literal value, or *, which matches anything.
For further details the postgres documentation
Filed under: OpenSource
Trackback Uri

