相关疑难解决方法(0)

psql:FATAL:数据库"<user>"不存在

我正在使用PostgreSql应用程序的mac(http://postgresapp.com/).我以前在其他机器上使用它但是在我的macbook上安装时给我带来了一些麻烦.我安装了应用程序,然后运行:

psql -h localhost
Run Code Online (Sandbox Code Playgroud)

它返回:

psql: FATAL:  database "<user>" does not exist
Run Code Online (Sandbox Code Playgroud)

似乎我甚至无法运行控制台来创建它试图找到的数据库.我跑的时候会发生同样的事情:

psql 
Run Code Online (Sandbox Code Playgroud)

或者如果我从应用程序下拉菜单中启动psql:

机器统计:

  • OSX 10.8.4

  • psql(PostgreSQL)9.2.4

任何帮助表示赞赏.

我也试图通过自制软件安装PostgreSql,我遇到了同样的问题.我还阅读了应用程序文档页面,其中说明:

当Postgres.app首次启动时,它会创建$ USER数据库,当没有指定时,它是psql的默认数据库.默认用户是$ USER,没有密码.

所以似乎应用程序没有创建$ USER但是我已经安装了 - >卸载 - 重新安装了几次,所以它必须是我的机器的东西.

我找到答案,但我不确定它是如何工作的,因为在这个线程上回答的用户 - > 获取Postgresql在Mac上运行:数据库"postgres"不存在没有跟进.我使用以下命令来打开psql:

psql -d template1
Run Code Online (Sandbox Code Playgroud)

我会留下这个答案,直到有人可以解释为什么这样做.

postgresql psql

649
推荐指数
14
解决办法
30万
查看次数

psql:无法连接到服务器:没有这样的文件或目录(Mac OS X)

重启我的Mac后,我遇到了可怕的Postgres错误:

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"?
Run Code Online (Sandbox Code Playgroud)

发生这种情况的原因是因为我的macbook完全因为一个无关的问题而冻结,我不得​​不使用电源按钮进行硬重启.重新启动后,由于此错误,我无法启动Postgres.

postgresql macos

213
推荐指数
12
解决办法
17万
查看次数

自制的postgres坏了

我使用自制软件在我的Mac(10.10.1/Yosemite)上安装了Postgresql 9.4.0.这是行不通的.

我在〜/ Library/LaunchAgents中创建了/usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist的软链接.

如果我尝试手动加载postgres,我会收到"正在进行操作"的消息

> launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
/usr/local/Cellar/postgresql/9.4.0/homebrew.mxcl.postgresql.plist: Operation already in progress
Run Code Online (Sandbox Code Playgroud)

然而,postgres似乎没有运行.

> ps auxw | grep post
billmcn           670   0.0  0.0  2424272    452 s000  R+   10:12PM   0:00.01 grep post
Run Code Online (Sandbox Code Playgroud)

我无法连接命令行客户端.

> psql
psql: 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"?
Run Code Online (Sandbox Code Playgroud)

据我所知,我已经尝试了其他 Stackoverflow线程上建议的所有修复程序来讨论这个问题.特别:

  • 我已经卸载并重新安装了postgres和随附的Ruby gem.我的机器上没有postgres 8.0版本.
  • 我已经验证了psql客户端程序是Homebrew安装的9.4.0版本而不是Mac系统二进制文件.
  • 我已经验证/usr/local/var/postgres/postmaster.pid不存在.
  • 我重新启动了机器.

我之前确实有Homebrew postgres在这台机器上工作.我认为破坏它的是从版本8升级到版本9,但我不确定.

我没有任何需要保留的数据库.我愿意用postgres开始清洁; 我现在只需要让它上班.有任何想法吗?


该问题似乎是/ usr/local/var/postgres目录的权限.这是我的var目录在事情不起作用时的样子.

ll /usr/local/var/
drwxr-xr-x  3 …
Run Code Online (Sandbox Code Playgroud)

postgresql macos homebrew

63
推荐指数
6
解决办法
4万
查看次数

服务器是在主机"localhost"(:: 1)上运行并在端口5432上接受TCP/IP连接吗?

在此之前,请注意我在Stack Overflow和网络上的文章中发现了几个类似的问题,但这些都没有帮助我解决我的问题:

现在,问题在于:

  • 我有一个像魅力一样的Rails应用程序.
  • 与我的合作者一起,我们使用GitHub一起工作.
  • 我们有一个master和一个mvp分支机构.
  • 我最近git用Homebrew(Mac)更新了我的版本.
  • 我们使用Foreman在本地启动我们的应用程序.

现在,当我尝试在本地启动应用程序时,出现以下错误:

PG::ConnectionBad at /
could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

我试图多次重启计算机.

我还检查了以下内容/usr/local/var/postgres:

PG_VERSION      pg_dynshmem     pg_multixact    pg_snapshots    pg_tblspc       postgresql.conf
base …
Run Code Online (Sandbox Code Playgroud)

ruby postgresql ruby-on-rails ruby-on-rails-3 ruby-on-rails-4

48
推荐指数
9
解决办法
8万
查看次数

在docker容器中安装PostgreSQL

我一直在关注几个不同的教程以及官方教程但是每当我尝试在容器中安装PostgreSQL时我会得到以下消息

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"?
Run Code Online (Sandbox Code Playgroud)

我已经在SO和整个互联网上查看了几个问题,但没有运气.

docker postgresql-9.3

16
推荐指数
2
解决办法
2万
查看次数

Mac OSX Lion Postgres不接受/tmp/.s.PGSQL.5432上的连接

对于Postbres的Homebrew安装,我遇到了常见的Mac OSX错误,

No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

这显然是由于系统上有多个安装.但是,通常的步骤并不能解决问题.

我可以成功启动Postgres并运行:

ps auxw | grep post
Run Code Online (Sandbox Code Playgroud)

回报..

euanmillar       847   0.0  0.0  2432768    588 s000  R+   11:19am   0:00.00 grep postgres
euanmillar       845   0.0  0.0  2439324    448   ??  Ss   11:19am   0:00.00 postgres:
stats collector process
euanmillar       844   0.0  0.0  2443176   1520   ??  Ss   11:19am   0:00.00 postgres:
autovacuum launcher process
euanmillar       843   0.0  0.0  2443044    544   ??  Ss   11:19am   0:00.00 postgres: wal …
Run Code Online (Sandbox Code Playgroud)

postgresql homebrew osx-lion

9
推荐指数
4
解决办法
2万
查看次数

PG错误无法连接到服务器:连接被拒绝服务器是否在端口5432上运行?

我最近更新了我的机器(运行Mountain Lion的MacBook Pro),从那时起,每当我设置一个rails项目时,我的机器就会崩溃,无法连接到PG.目前,这是我尝试去localhost时遇到的错误;

PG :: ERROR无法连接到服务器:连接被拒绝服务器是否在主机"localhost"
(:: 1)上运行并接受端口5432上的TCP/IP连接?无法连接到服务器:连接被
拒绝服务器是否在主机"localhost"(127.0.0.1)上运行并接受端口5432上的TCP/IP连接?无法连接到服务器:连接被拒绝服务器是否在主机"localhost"(fe80 :: 1)上运行并接受端口5432上的TCP/IP连接?

这是一份清单,以及我尝试的事项清单;

  1. PostgreSQL版本是9.3.4
  2. 我通过HomeBrew安装它
  3. 我有host: localhost我的database.yml文件
  4. Rails版本4.1.1,ruby 2.0.0p247(2013-06-27修订版41674)[x86_64-darwin12.5.0]
  5. brew uninstall postgresql然后跑brew install postgresql
  6. 试图访问我的postgres.conf文件,但不允许通过PGAdmin和命令行
  7. Ran locate pg_hba.conf和终端出局了;

    WARNING: The locate database (/var/db/locate.database) does not exist.
    
    Run Code Online (Sandbox Code Playgroud)
  8. 我也尝试过使用rails 4.0,但我仍然遇到了问题

  9. 在我更新计算机之前,我仍然可以在我的机器上处理启动/完成的其他项目.

  10. 当我psql从终端运行时,我得到了 psql: 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"?

我真的迷失在这里,不知道还能做什么.任何帮助将非常感激.

更新:

感谢这个问题,只需下载Postgres.app for Mac 即可解决所有问题.现在一切都很好.

ruby postgresql macos ruby-on-rails-4

3
推荐指数
3
解决办法
1万
查看次数

PG :: ConnectionBad升级到Yosemite和postgresql 9.4.4

我刚刚将我的mac OS X更新为Yosemite,版本10.10.4,并将postgresql更新为:psql(PostgreSQL)9.4.4.

在我的Rails 4.2.1应用程序上运行rake db:migrate后,我的终端会话响应:

rake aborted!
PG::ConnectionBad: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?
could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

在我的终端会话中简单地输入psql也会显得有些偏差:

$ psql
psql: 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"? …
Run Code Online (Sandbox Code Playgroud)

postgresql macos rails-4-2-1

3
推荐指数
1
解决办法
1121
查看次数