Postgresql psql:无法连接到服务器:

Postgresql psql:无法连接到服务器:,postgresql,ubuntu,psql,Postgresql,Ubuntu,Psql,我最近安装了ubuntu并从brew下载了postgres,但在尝试进入psql时,我遇到了以下错误: psql: error: could not connect to server: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.

我最近安装了ubuntu并从brew下载了postgres,但在尝试进入psql时,我遇到了以下错误:

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

我尝试过替代变量,但没有成功,有人能帮我吗

你用pg_ctl初始化了它吗?我怎么做?你创建了数据库集群吗?如果你这样做了,你启动了吗?你有没有看一下这是谷歌搜索“psql:错误:无法连接到服务器:无法连接到服务器:没有这样的文件或目录”的结果。如果有人能回答这个问题就好了。