PSQL:无法连接到服务器:在Mac OSX上没有这样的文件或目录

问题描述:

我试图用home brew我的Mac上安装PostgreSQL,当我尝试运行命令psql我收到以下错误PSQL:无法连接到服务器:在Mac OSX上没有这样的文件或目录

Harshas-MacBook-Pro:~ harshamv$ psql 
psql: could not connect to server: No such file or directory 
    Is the server running locally and accepting 
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 

看起来系统无法识别安装。

Harshas-MacBook-Pro:~ harshamv$ locate psql | grep /bin 
/usr/local/Cellar/postgresql/9.4.0/bin/psql 
/usr/local/bin/psql 

的过程似乎运行

Harshas-MacBook-Pro:~ harshamv$ ps -aef|grep postgres 
     501 12075 11832 0 11:54AM ttys001 0:00.00 grep postgres 

而且plist文件

Harshas-MacBook-Pro:~ harshamv$ launchctl load -w /usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist 
/usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist: Operation already in progress 


Harshas-MacBook-Pro:~ harshamv$ which psql 
/usr/local/bin/psql 

Harshas-MacBook-Pro:~ harshamv$ echo $PATH 
/Users/harshamv/.rvm/gems/ruby-2.1.2/bin:/Users/harshamv/.rvm/gems/[email protected]/bin:/Users/harshamv/.rvm/rubies/ruby-2.1.2/bin:/Applications/bin/php5/bin/:/Applications/Mamp/htdocs/prayag/lib/Cake/Console:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/harshamv/.rvm/bin:/usr/local/mongodb/bin 
+0

程序问你一个问题,'/ tmp/.s.PGSQL.5432'怎么样?你有两个版本的psql安装? – Schwern 2015-02-06 06:31:49

+0

@Schwern我该如何检查? – 2015-02-06 06:44:38

+0

'ls -l /tmp/.s.PGSQL.5432'来检查临时文件。 '哪个-a psql'来检查多个安装。 – Schwern 2015-02-06 06:47:00

你没有运行PostgreSQL服务器。你的ps输出只显示你自己的ps grep。

您也可能安装了PostgreSQL的两个版本,并且您正在运行与错误关联的psql客户端。您可以运行which -a psql来查看PATH中的所有psql二进制文件。

The PostgreSQL Wiki has a page devoted to figuring out Homebrew problems

This answer to your exact problem may help

+0

在卸载并重新安装它现在我得到harshamv $哪-a psql /usr/local/bin/psql – 2015-02-07 05:45:59

+0

@HarshaMV好的,你只有一个安装。 – Schwern 2015-02-07 05:52:02