I need to create database.
我需要创建数据库。
First I run: sudo su - postgres
, then: createdb test
首先我运行:sudo su - postgres,然后:createdb test
And I keep getting this error:
我一直收到这个错误:
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"
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.
这是意料之外的,我从未遇到过psql的任何问题,但这次我没有得到什么问题。并且没有外部服务器,我在本地连接。
I am running on Ubuntu.
我在Ubuntu上运行。
1 个解决方案
#1
The error message suggests:
错误消息表明:
Is the server running locally
服务器是否在本地运行
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.
并根据ps -ef |的结果grep“post”发表在评论中,答案是肯定的否,服务器进程不存在,服务器没有运行。
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.
你写的这个事实我从来没有遇到过psql的任何问题,建议它之前安装并正常工作,在这种情况下查看/ var / log / postgresql里面的最新日志文件,检查是否有任何致命的错误消息,说明为什么服务器没有启动。
#1
The error message suggests:
错误消息表明:
Is the server running locally
服务器是否在本地运行
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.
并根据ps -ef |的结果grep“post”发表在评论中,答案是肯定的否,服务器进程不存在,服务器没有运行。
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.
你写的这个事实我从来没有遇到过psql的任何问题,建议它之前安装并正常工作,在这种情况下查看/ var / log / postgresql里面的最新日志文件,检查是否有任何致命的错误消息,说明为什么服务器没有启动。