Postgresql配置文件在哪里:Windows上的'postgresql.conf'?

pyt*_*ngo 61 postgresql

我收到此消息但我找不到postgresql.conf文件:

OperationalError: could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "???" and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
    Is the server running on host "???" and accepting
    TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

jon*_*scb 88

在我的机器上:

C:\Program Files\PostgreSQL\8.4\data\postgresql.conf

  • 谢谢哥们儿.生命保护.*吻* (2认同)
  • 请注意:将应用程序数据放入c:\ Program Files通常不是一个好主意 (2认同)
  • 对于PostgreSQL 9.2以及9.x系列中的早期版本,它位于C:\ ProgramData\PostgreSQL\9.2\data\postgresql.conf的更合适的位置(至少在Windows 7中). (2认同)

spl*_*ash 24

postgresql.conf位于PostgreSQL的数据目录中.数据目录的设置期间配置和设置将被保存为PGDATA在条目c:\Program Files\PostgreSQL\<version>\pg_env.bat中,例如

@ECHO OFF
REM The script sets environment variables helpful for PostgreSQL

@SET PATH="C:\Program Files\PostgreSQL\<version>\bin";%PATH%
@SET PGDATA=D:\PostgreSQL\<version>\data
@SET PGDATABASE=postgres
@SET PGUSER=postgres
@SET PGPORT=5432
@SET PGLOCALEDIR=C:\Program Files\PostgreSQL\<version>\share\locale
Run Code Online (Sandbox Code Playgroud)

或者,SHOW config_file;如果您是超级用户,则可以查询数据库.

  • @philshem我的回答中的例子只是提到的`pg_env.bat`的内容,而不是用在`postgresql.conf`中.`postgresql.conf`文件应存在于PGDATA目录中,如下所示:[postgresql.conf.sample](http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f = SRC /后端/ utils的/杂项/ postgresql.conf.sample; HB = HEAD) (2认同)