Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable Postgresql in Cygwin

Tags:

cygwin

I installed Cygwin with Perl and Postgresql packages enabled.

Then typed:

 /usr/bin/cygserver-config (This will install the service)

Then type:

net start cygserver(This starts the service)

Next i need to enable Postgresql in Cygwin, so i tried the commands mentioned below:

cygrunsrv -S cygserver

initdb -D /usr/share/postgresql/data

pg_ctl start -D /usr/share/postgresql/data -l /var/log/postgresql.log

createdb

psql

I get an error:

$ initdb -D /usr/share/postgresql/data
-bash: initdb: command not found

$ pg_ctl start -D /usr/share/postgresql/data -l /var/log/postgresql.log
-bash: pg_ctl: command not found

Can someone please tell me how to get it right.

like image 356
Sid Avatar asked Apr 10 '13 02:04

Sid


1 Answers

The Postgresql initdb and pg_ctl executables are located under /usr/sbin.

I am guessing that /usr/sbin is not on your PATH setting. Adding it should do the trick.

I use a start/stop script which I keep under $HOME/bin called pg. Here's the gist.

like image 161
buruzaemon Avatar answered Oct 23 '22 05:10

buruzaemon