问题描述
我正在尝试从命令行连接到我的postgres服务器:
I'm trying to connect to my postgres server from command line :
$> psql
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"?
我正在尝试运行服务器:
And I'm trying to run the server :
$>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.
有人可以为我指出如何配置服务器使其工作吗?
Can anyone point out for me how can I configure my server so it works?
推荐答案
我已经解决了这个问题。实际上,Mac OS 10.8.5有自己的psql命令。所以这是一个路径问题。如果从MacPort安装postgres,系统将始终引用初始的psql命令。
I've solved this problem. Actually Mac OS 10.8.5 has his own psql command. So it's a path issue. If you install postgres from MacPort, the system will always refer to the initial psql command.
我建议您从brew中安装postgres,如。
I advice you to install postgres from brew as shown here.
您还将重新定义PATH环境变量并将其导出到.profile文件中:
You'll have also redefine your PATH environment variable and export it in your .profile file:
export PATH=/usr/local/bin:$PATH
这篇关于如何在MacOS 10.8.5上配置PostgreSQL服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!