我在Windows 10上。我下载了最新版本的Psql。
我当时想:
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
就像是:
服务器启动
访问被拒绝。
答案 0 :(得分:1)
我认为您正在尝试在logfile
内创建C:\Program Files\PostgreSQL\9.6\bin
,但您没有写入权限
指定"pg_ctl" -D "C:\psql_db" -l "c:\users\joe\logfile" start
答案 1 :(得分:0)
这是因为Windows文件权限。您可以将数据文件夹放在桌面上" c:\ Users \\ Desktop \"而不是" C:\ psql_db"。或者也许为您的用户提供更多权限。