PostgreSQL无法连接到数据库

时间:2015-06-30 17:31:57

标签: ruby-on-rails postgresql

我在Ubuntu上尝试以任何方式连接到postgresql,即运行psql抛出:

could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

sudo /etc/init.d/postgresql restart解决了这个问题,然而,一旦我重新启动计算机,我总是必须再次在终端中输入该行。有没有办法解决这个问题,所以我不必输入该行?

1 个答案:

答案 0 :(得分:0)

重启计算机之前是否杀了服务器?如果您只是重新启动计算机,或者在服务器运行时电池耗尽,则很可能会遇到此问题。