新手问题 postgres 的问题

jeremy16601 · 2013年07月06日 · 最后由 SharpX 回复于 2013年07月06日 · 3803 次阅读

postgres@lxq/home/llx$ psql psql: could not connect to server: 没有那个文件或目录 Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

ubuntu 下的错误,求大牛帮忙

mkdir /var/run/postgresql ?

或者 initdb 还没跑?

或许只是服务没有启动。

可能是监听了 ip 地址,psql -h 127.0.0.1 看看

#3 楼 @pongyo lll@lll:~$ psql -h 127.0.0.1 psql: could not connect to server: 拒绝连接 Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

netstat -na| grep 5432 看一下你的端口开了没有

#5 楼 @ZombieCoder tcp 0 0 192.168.23.136:54329 173.194.72.199:80 ESTABLISHED

那就是你的服务没有开

正常的应该是:

tcp4       0      0  127.0.0.1.5432         *.*                    LISTEN
tcp6       0      0  ::1.5432               *.*                    LISTEN

启动一下服务

配置文件把 localhost 换成 *

需要 登录 后方可回复, 如果你还没有账号请 注册新账号