Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access is denied error when initializing PostgreSQL DB on Windows

I'm on Windows 10. I downloaded the most recent version of Psql.

I was like:

C:\Program Files\PostgreSQL\9.6\bin>initdb.exe "C:\psql_db"
The files belonging to this database system will be owned by user "Sean".
This user must also own the server process.

The database cluster will be initialized with locale "English_United States.1252".
The default database encoding has accordingly been set to "WIN1252".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory C:/psql_db ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... windows
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    "pg_ctl" -D "C:\psql_db" -l logfile start
C:\Program Files\PostgreSQL\9.6\bin>"pg_ctl" -D "C:\psql_db" -l logfile start

And it was like:

server starting

Access is denied.

like image 262
Sean Reddy Avatar asked Sep 11 '16 13:09

Sean Reddy


1 Answers

I think you are trying to create the logfile inside C:\Program Files\PostgreSQL\9.6\bin, for which you don't have write permission

Specify something like "pg_ctl" -D "C:\psql_db" -l "c:\users\joe\logfile" start

like image 117
user3556757 Avatar answered Sep 24 '22 14:09

user3556757