Results 1 to 2 of 2

Thread: Silent initdb

  1. #1
    Join Date
    Apr 2014

    Unanswered: Silent initdb


    I am trying to create a script to install Postgresql on a computer. When the script executes dbinit.exe it opens another command prompt window, where in the first line shows up as "Enter the DB Password".. It stays on this prompt for like 3-4 seconds and then it automatically enters the password and continues the installation.

    When the users install postgres using this script, they think that they need to enter the password....

    Is there any way that I can silently install and execute dbinit.exe so that it runs in the background and does not show up on the screen.


  2. #2
    Join Date
    Nov 2003
    Provided Answers: 8
    There is no dbinit.exe for Postgres. I guess you really mean initdb.exe.

    You can prevent it asking for a password by supplying one using the --pwfile parameter. If you do that from within a batch file something like this works:

    set pwfile=pg_password.txt
    echo very_secret_password>%pwfile%
    initdb -D datadir -U postgres --pwfile=%pwfile% -E UTF8 -A md5
    This will create the superuser "postgres" with the password "very_secret_password" without a prompt.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags:

    Tips for good questions:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts