postgres不知道在哪里可以找到服务器配置文件

时间:2016-09-28 09:28:00

标签: postgresql

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

它出现以下错误:

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维持similar Issue
  • postgres -D C:\Program Files\PostgreSQL\data\ 给了我以下输出:
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

1 个答案:

答案 0 :(得分:2)

如错误所示,要启动postgresql集群,您必须设置数据文件夹的路径。可能类似于:

pg_ctl

但建议使用postgres代替pg_ctl -D "C:\Program Files\PostgreSQL\data\" start

Is another postmaster already running on port 5432?

不要忘记查看有关how to start a serverhow to use pg_ctl的postgres文档。

通常,postgres安装程序会创建一个服务/守护程序,因此无需手动启动服务器。所以,如果你收到像

这样的错误
psql

这可能意味着服务器已在运行。尝试使用 override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

连接到它