postgresql postgres 不知道在哪里可以找到服务器配置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32629604/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
postgres does not know where to find server configuration
提问by Mischa
I' trying to run PostgreSQL for RoR on my new mac (i'm a newbie). I followed the installation guide however i can't get it to work properly. I've found similar questions but those didn't help. I get the following error on 'postgres' cmd.
我试图在我的新 Mac 上为 RoR 运行 PostgreSQL(我是新手)。我遵循了安装指南,但是我无法让它正常工作。我发现了类似的问题,但没有帮助。我在 'postgres' 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.
however when I set my -D invocation through
但是,当我通过设置 -D 调用时
postgres -D /usr/local/var/postgres
I get another error
我收到另一个错误
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 6621) running in data directory
"/usr/local/var/postgres"?
I've tried to use 'kill 6621' but then it just seems to startup another postmaster on a different PID. I've also tried removing PID and running
我曾尝试使用“kill 6621”,但它似乎只是在不同的 PID 上启动了另一个 postmaster。我也试过删除PID并运行
postgres -D /usr/local/var/postgres
I get the following errors:
我收到以下错误:
LOG: could not bind IPv6 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG: could not bind IPv4 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets
Does anyone know what i'm doing wrong?
有谁知道我做错了什么?
回答by Francisco Puga
Usually, when postgres is installed a service/daemon is created in the system so, there is no need to launch the server by hand. You are getting the error because the service is already running.
通常,当安装 postgres 时,系统中会创建一个服务/守护程序,因此无需手动启动服务器。您收到错误是因为该服务已在运行。
Try to connect to the database using psql
尝试使用连接到数据库 psql