How to manually configure and start PostgreSQL on

2019-03-09 01:32发布

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

2条回答
Melony?
2楼-- · 2019-03-09 02:07

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
查看更多
萌系小妹纸
3楼-- · 2019-03-09 02:23

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!
查看更多
登录 后发表回答