postgres不知道在哪里可以找到服务器配置文件 [英] postgres does not know where to find the server configuration file

查看:910
本文介绍了postgres不知道在哪里可以找到服务器配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了PostgreSQL,但是当我在Windows CMD中运行命令 postgres

I had installed PostgreSQL but when I do run command postgres in windows CMD

它给出以下错误:

postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.

即使在运行命令后


  • initdb postgres 保持为类似问题

  • postgres -DC:\Program Files\PostgreSQL\data\
    给了我以下输出:

  • initdb postgres as maintained similar Issue
  • postgres -D C:\Program Files\PostgreSQL\data\ gave me following output:
2016-09-28 15:04:57 PDT LOG:  could not bind IPv6 socket: Only one usage of each socket address (protocol/network address/port) is normally permitted.
2016-09-28 15:04:57 PDT HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2016-09-28 15:04:57 PDT LOG:  could not bind IPv4 socket: Only one usage of each socket address (protocol/network address/port) is normally permitted.    
2016-09-28 15:04:57 PDT HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
2016-09-28 15:04:57 PDT WARNING:  could not create listen socket for "*"
2016-09-28 15:04:57 PDT FATAL:  could not create any TCP/IP sockets
2016-09-28 15:04:57 PDT LOG:  database system is shut down


推荐答案

。可能是这样的:

postgres -D "C:\Program Files\PostgreSQL\data\"

,但是使用 pg_ctl 代替 postgres :

pg_ctl -D "C:\Program Files\PostgreSQL\data\" start

别忘了查看有关如何启动服务器如何使用pg_ctl

通常, postgres安装程序将创建服务/守护程序,因此无需手动启动服务器。因此,如果您收到类似

Usually, the postgres installlers creates a service/daemon so there is not need to launch the server by hand. So if you get an error like

Is another postmaster already running on port 5432?

这可能意味着服务器已经在运行。尝试使用 psql

It probably means that the server is already running. Try to connect to it using psql

这篇关于postgres不知道在哪里可以找到服务器配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆