Postgresql 配置文件在哪里:“postgresql.conf”在 Windows 上?

发布于 2024-10-08 04:27:11 字数 410 浏览 2 评论 0原文

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

I'm receiving this message but I can't find the postgresql.conf file:

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

っ左 2024-10-15 04:27:11

在我的机器上:

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

On my machine:

C:\Program Files\PostgreSQL\8.4\data\postgresql.conf
青瓷清茶倾城歌 2024-10-15 04:27:11

postgresql.conf 位于PostgreSQL 的数据目录。数据目录是在安装过程中配置的,并且设置保存为 c:\Program Files\PostgreSQL\\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; 查询数据库。

postgresql.conf is located in PostgreSQL's data directory. The data directory is configured during the setup and the setting is saved as PGDATA entry in c:\Program Files\PostgreSQL\<version>\pg_env.bat, for example

    @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

Alternatively you can query your database with SHOW config_file; if you are a superuser.

吖咩 2024-10-15 04:27:11

按照这个路径就可以找到

C:\Program Files\PostgreSQL\13\data

You can find it by following this path

C:\Program Files\PostgreSQL\13\data
狼性发作 2024-10-15 04:27:11

在我的机器上:

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

On my machine:

C:\Program Files (x86)\OpenERP 6.1-20121026-233219\PostgreSQL\data
那一片橙海, 2024-10-15 04:27:11

你会得到 postgressql.conf 文件

C:/programfiles/postgressql/14/data
您还将获得 pg_hba 来检查用户名密码

you will get postgressql.conf file

C:/programfiles/postgressql/14/data
you will also get the pg_hba to check username password

〆一缕阳光ご 2024-10-15 04:27:11

PGD​​ATA 在 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)

PGDATA is assumed as ConfigDir under Postgresql, this works under docker and normal installation as well, this is default configuration until not changed explicitly.

on my docker PGDATA is configure as "/var/lib/postgresql/data" hence all configuration can be found under this directory.

#------------------------------------------------------------------------------
# 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)
只为一人 2024-10-15 04:27:11

您可以使用以下路径找到 Postgres 全局配置文件:

  • 替换为您已安装的 Postgres 版本。

    C:\Program Files\PostgreSQL<版本>\data

这通常是安装时的默认位置。

但是,如果您仍然无法使用路径找到文件,请尝试使用 Windows 中的文件搜索。

You can find your Postgres global config file using the following path:

  • Replace with the Postgres version you have installed.

    C:\Program Files\PostgreSQL<version>\data

This is usually the default location at installation.

However, if you are still unable to locate the file using the path try using file search in Windows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文