在Windows上初始化PostgreSQL DB时出现拒绝访问错误



我用的是Windows 10。我下载了最新版本的Psql。

我想:

C:Program FilesPostgreSQL9.6bin>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 FilesPostgreSQL9.6bin>"pg_ctl" -D "C:psql_db" -l logfile start

它就像:

服务器开始

访问被拒绝

我认为您试图在C:Program FilesPostgreSQL9.6bin中创建logfile,您没有写权限

指定"pg_ctl" -D "C:psql_db" -l "c:usersjoelogfile" start

这是因为windows文件权限。您可以将数据文件夹放在桌面"c:Users\ desktop "而不是"c: psql_db"。或者给你的用户更多的权限。

最新更新