PostgreSQL错误:无法连接到数据库模板1:无法连接到服务器:没有这样的文件或目录 [英] PostgreSQL error: could not connect to database template1: could not connect to server: No such file or directory
问题描述
我需要创建数据库。
首先运行: sudo su-postgres
,然后: createdb test
我一直收到此错误:
createdb: could not connect to database template1: 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"
这是意外的,我从来没有遇到了psql的任何问题,但是这次我没有弄错。而且没有外部服务器,我在本地连接。
This is unexpected, I have never encountered any problems with psql, but this time I don't get what is wrong. And there is no external server, I am connected locally.
我在Ubuntu上运行。
I am running on Ubuntu.
推荐答案
错误消息提示:
服务器是否在本地运行
Is the server running locally
并根据 ps -ef | grep post
发表在评论中,答案是确定的否,即服务器进程不存在,服务器未运行。
and according to the result of ps -ef | grep "post"
posted in the comments, the answer is a definitive No, the server processes are not there, the server is not running.
您写的事实我从未遇到过psql的任何问题,建议它已经安装并可以运行,在这种情况下,请查看 / var / log / postgresql 中的最新日志文件。 code>检查是否有致命错误消息,指示服务器为什么无法启动。
That fact that you write i have never encountered any problems with psql, suggests that it was installed and working before, in that case look at the most recent log file inside /var/log/postgresql
to check for any fatal error message indicating why the server didn't start.
这篇关于PostgreSQL错误:无法连接到数据库模板1:无法连接到服务器:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!