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

4xrmg8kj  于 2023-01-21  发布在  Windows
关注(0)|答案(6)|浏览(249)

我收到此消息,但找不到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?
svdrlsy4

svdrlsy41#

在我的计算机上:

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

a2mppw5e2#

postgresql.conf位于PostgreSQL的数据目录中。数据目录在设置过程中进行配置,设置将另存为c:\Program Files\PostgreSQL\<version>\pg_env.bat中的PGDATA条目,例如

@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

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

oxf4rvwz

oxf4rvwz3#

您可以通过以下路径找到它

C:\Program Files\PostgreSQL\13\data
vfhzx4xs

vfhzx4xs4#

在我的计算机上:

C:\Program Files (x86)\OpenERP 6.1-20121026-233219\PostgreSQL\data
13z8s7eq

13z8s7eq5#

您将获得postgressql.conf文件
C:/programfiles/postgressql/14/data,您还将获得pg_hba以检查用户名和密码

sgtfey8w

sgtfey8w6#

PGDATA被假定为Postgresql下的ConfigDir,这在Docker和正常安装下也有效,这是默认配置,除非明确更改。
在我的Docker上,PGDATA被配置为“/var/lib/postgresql/data”,因此所有配置都可以在此目录下找到。

#------------------------------------------------------------------------------
# FILE LOCATIONS
#------------------------------------------------------------------------------

# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.

#data_directory = 'ConfigDir'       # use data in another directory
                # (change requires restart)
#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file
                # (change requires restart)
#ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file
                # (change requires restart)

# If external_pid_file is not explicitly set, no extra PID file is written.
#external_pid_file = ''         # write an extra PID file
                # (change requires restart)

相关问题