Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run PostgreSQL as Windows service

I had this in my Windows services:

C:/Program Files/PostgreSQL/8.4/bin/pg_ctl.exe runservice -N "postgresql-8.4" -D "D:/PostgreSQL/8.4/data" -w 

It never finishes executing. But if I did this on the dos shell:

C:/Program Files/PostgreSQL/8.4/bin/pg_ctl.exe start -N "postgresql-8.4" -D "D:/PostgreSQL/8.4/data" -w 

Notice that I only changed the "runservice" to "start" and it works just fine.

Any idea?

like image 396
David Avatar asked Aug 09 '09 11:08

David


2 Answers

The command runservice can only be executed by the service manager

in order to fix my localhost windows 7 to start postgres as a service i used the following command to start the data

 pg_ctl -D "C:\Program Files\PostgreSQL\9.1\data" start  

Then checked the status for errors

 pg_ctl -D "C:\Program Files\PostgreSQL\9.1\data" status  

if you get error 1063 , its more than likely permissions, i executed the following command

 cacls "C:\Program Files\PostgreSQL\9.1\data" /E /T /C /G postgres:F 

then reran the start/status, it showed everything fine, but still service manager would not start the service

So, in Services->postgresql->options->logon i set the log on as the Local system account instead of the postgres user, and voila it worked

like image 102
Jay Rizzi Avatar answered Sep 18 '22 18:09

Jay Rizzi


this happened to me because i set my data directory to be somewhere the postgres windows user account didn't have access to.

like image 45
pstanton Avatar answered Sep 20 '22 18:09

pstanton