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