我的psql有一个奇怪的问题,在上一次会话中工作得很好。突然,当我尝试访问我的localhost服务器时,我遇到了这个问题
PG :: ConnectionBad 无法连接到服务器:连接被拒绝服务器是否在主机“localhost”(127.0.0.1)上运行并接受端口5432上的TCP / IP连接?
PostgreSQL 8.2
及以下的固定精度为10,从PostgreSQL 8.3
它的固定精度为19. PostgreSQLColumn.extract_precision * 我正在使用Postgres 9.5和Ubuntu 14.
当我在终端输入"psql"
时,我收到消息:
psql: 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"?"
答案 0 :(得分:1)
您似乎在启动服务器之前尝试打开与postgres的客户端/控制台连接。以下是启动服务器的信息:
http://www.postgresql.org/docs/9.1/static/server-start.html
修改的 当你在Ubuntu上尝试:
sudo /etc/init.d/postgresql restart
答案 1 :(得分:0)
您是否已登录postgres? (sudo -i -u user)user是postgres帐户的名称。
PostgreSQL服务器应该一直在运行。
答案 2 :(得分:0)
由于我使用Brew来安装PG,因此对我有用的修复程序如下所示:
$ brew uninstall postgresql
$ exec $SHELL
$ brew postgresql-upgrade-database
$ brew services start postgresql