postgresql - 在 mac 上启动 - `pg_ctl` 不工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16118723/
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
postgresql - start on mac - `pg_ctl` not working
提问by Lucy Weatherford
I want to use the pre-installed postgresql on my local machine (mac os 10.7.5), when I run which psql
I find it (in /usr/bin/psql
), but then running
我想在我的本地机器(mac os 10.7.5)上使用预装的 postgresql,当我运行时which psql
我发现它(在/usr/bin/psql
),但然后运行
pg_ctl -D /usr/bin/psql -l /usr/bin/psql/server.log start
results in:
结果是:
-bash: pg_ctl: command not found
How can I start/use my postgresql database? do I need to install it (with say Homebrew) or can I use the pre-installed one on my mac?
I also tried using the initdb
command (initdb /usr/bin/psql -E utf8
) and also go tthe same message: -bash: initdb: command not found
.
如何启动/使用我的 postgresql 数据库?我需要安装它(比如 Homebrew)还是我可以在我的 mac 上使用预装的?我也尝试使用initdb
命令 ( initdb /usr/bin/psql -E utf8
) 并且也得到相同的消息:-bash: initdb: command not found
.
Also, is this psql
the same as postgres
? (I tried which postgres
and got nothing)
另外,这psql
与postgres
? (我试过which postgres
了,一无所获)
Update: I'm using psql
commands in the command line, but am getting there the following message (for psql -l
and psql -a
for instance):
更新:我使用psql
的命令在命令行,但我越来越有下列消息(psql -l
及psql -a
为例):
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
采纳答案by Chris Farmiloe
OS X ships with the command line client (for interacting with postgres databases) not the server.
OS X 附带命令行客户端(用于与 postgres 数据库交互)而不是服务器。
You need to install the server.
您需要安装服务器。
Check the postgres siteor grab the postgres.app