psql: could not connect to server: No such file or directory
postgresql报错:
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"?
1.可能是服务没启动,以下3中启动方式:
(1) postmaster -D /usr/local/pgsql/data/ (注意:这里的/usr/local/pgsql/data/ 是你的postgresql安装路径)
(2)postmaster -D /usr/local/pgsql/data/ > logfile 2>&1 &
(3)pg_ctl start -D /usr/local/pgsql/data/
2.可能是系统环境没加psql:
用which psql回车找到psql路径,用echo $PATH查看PATH中有没有psql路径,没有的话就添加:方法如下:http://www.cnblogs.com/nightswatch/articles/4439776.html
3.还有问题的话:移步http://stackoverflow.com/questions/12472988/postgresql-error-could-not-connect-to-server-no-such-file-or-directory