PostgreSQL cannot connect to database

2019-08-12 03:46发布

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 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?

1条回答
地球回转人心会变
2楼-- · 2019-08-12 04:03

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.

查看更多
登录 后发表回答