PostgreSQL无法连接到数据库 [英] PostgreSQL cannot connect to database

查看:707
本文介绍了PostgreSQL无法连接到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu上,尝试通过任何方式连接到postgresql,即运行 psql 引发:

I'm on Ubuntu and trying to connect to postgresql by any means, i.e. running psql throws:

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重新启动解决了问题,但是,一旦我重新启动计算机,我总是必须再次将线路输入终端。有什么方法可以解决此问题,所以我不必键入该行?

sudo /etc/init.d/postgresql restart fixes the problem, however, once I restart the computer, I always have to type the line into terminal all over again. Is there any way to fix this problem, so I don't have to type the line?

推荐答案

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

Do you kill the server before restarting the computer? If you're just restarting the computer, or if the battery dies while your server is running, you more than likely will run into this issue.

这篇关于PostgreSQL无法连接到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆