onedevteam.com
onedevteam.com

Reputation: 4178

How to manually configure and start PostgreSQL on windows?

I have application that use mysql database, but now i need to port it to postgres... In my current installation i have embedded mySQL binaries, and i manually change my.ini file to change default location of mysql server to apppath, install mySQL service and start it... Is this possible (and how) in PostgreSQL?

Thanks in advance

Upvotes: 20

Views: 63471

Answers (2)

user330315
user330315

Reputation:

In addition to what Nirmal wrote, what I usually do:

  • Download the ZIP distribution from http://www.enterprisedb.com/products/pgbindownload.do
  • Unzip the archive
  • Run initdb specifying the location of the desired data directory (note this should not reside in c:\Program Files as that is not writeable for a regular user. You should create this e.g. in %APPDATA%
  • After initdb has finished, adjust settings in (the generated) postgresql.conf (e.g. shared memory, listen addres, log settings and such). I do this using search & replace.
  • The start the server using pg_ctl as mentioned by Nirmal (and described in the manual).
  • Make sure you start PostgreSQL using the same (Windows) user that you used when running initdb to avoid problems with file permissions!
  • You can use pg_ctl register ... to create a Windows service to automatically start Postgres.

Upvotes: 11

Nirmal- thInk beYond
Nirmal- thInk beYond

Reputation: 12054

use pgsql bundle zip so u know actual path that not requires installation

initialize database

initdb.exe <datafolderpath>

init.db & pg_ctl is under

pgsql/bin

start database

"pg_ctl" -D "<datafolderpath>" -l logfile start

Upvotes: 36

Related Questions