Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 优胜美地安装后,PostgreSQL仍不工作_Ruby On Rails_Postgresql_Osx Yosemite - Fatal编程技术网

Ruby on rails 优胜美地安装后,PostgreSQL仍不工作

Ruby on rails 优胜美地安装后,PostgreSQL仍不工作,ruby-on-rails,postgresql,osx-yosemite,Ruby On Rails,Postgresql,Osx Yosemite,所以,自从Yosemite升级以来,我一直在尝试让我的postgresql db在我的rails应用程序上运行。我希望我现在从未升级过。我在网上搜索过,这里有一个关于stackoverflow的相关问题 我在命令行上遇到同样的错误 No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 在我的web浏

所以,自从Yosemite升级以来,我一直在尝试让我的postgresql db在我的rails应用程序上运行。我希望我现在从未升级过。我在网上搜索过,这里有一个关于stackoverflow的相关问题

我在命令行上遇到同样的错误

No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
在我的web浏览器中,它给了我PG::ConnectionBad错误。 我做了@Donovan为解决问题而提出的解决方案,添加了三个缺少的目录pg_tblspc、pg_twophase、pg_stat_tmp,Yosemite出于某种原因删除了它们。我运行了所有正确的命令行操作,但仍然收到相同的错误,没有运气。这也是我的database.yml文件的外观

# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
#   gem install pg
# On Mac OS X with macports:
#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
#   gem install pg
#       Choose the win32 build.
#       Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'pg'
#
development:
  adapter: postgresql
  encoding: unicode
  database: task_manager_development
  pool: 5


# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
# host: localhost
# port: 5432

# Schema search path. The server defaults to $user,public
#schema_search_path: myapp,sharedapp,public

# Minimum log levels, in increasing order:
#   debug5, debug4, debug3, debug2, debug1,
#   log, notice, warning, error, fatal, and panic
# The server defaults to notice.
#min_messages: warning

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
 adapter: postgresql
 encoding: unicode
 database: task_manager_test
 pool: 5


production:
 adapter: postgresql
 encoding: unicode
 database: task_manager_production
 pool: 5

我也尝试过取消对本地主机和端口5432的评论,但仍然没有成功。我真的需要帮助。基本上,我在网上读到的所有其他内容都说,添加多个目录并重新启动postgresql应该可以解决问题,但对我来说并不奏效。我一定是做得不对,或者遗漏了什么。我正在考虑重新安装homebrew和ROR,但我担心我可能会丢失ROR应用程序中的所有数据。任何帮助都会很好

编辑postgresql.conf文件并添加以下内容:

unix_socket_directory = '/tmp/'

然后重新启动postgres

您考虑过从源代码安装吗?如果您安装在主目录下,也会变得更简单:./configure-prefix=/Users/your_user/opt;制作进行安装。我一直在推迟升级…你是说从我的rails应用程序的源或目录重新启动postgresql?你可能还想检查所提到的各种文件和目录的权限/所有权。我该怎么做@DmitriGoldring?使用“ls-l”列出数据库目录中创建这些目录的文件,您应该会看到用户名和组,该组可能是staff。确保用户名与目录中的其他文件匹配。如果没有,则可以使用chown命令修复所有权。权限位于“ls”输出的开头,并且应该与其余目录匹配。如何从命令行执行此操作?我是否确实尝试在文本编辑器中打开该文件?或者你是说在我的database.yml文件中?好的,我相信我在连接和身份验证区域找到了它。这是当前注释掉的,unix_socket_directories='/tmp'逗号分隔的目录列表我应该取消注释,保存,然后重新启动并查看它是否工作?对不起,我是这个postgresql调试的新手。是的。它可能会将文件保存到另一个目录,您的客户正在查看该目录。@Joe_Love我认为它在某种程度上纠正了问题,但现在它在重新启动服务器后告诉我…日志:无法打开临时文件目录pg_tblspc/。keep/pg_9.3_201306121/pgsql_tmp:不是目录日志:无法打开表空间目录pg_tblspc/。keep/pg_9.3_201306121:不是目录日志:数据库系统在2014-12-12 13:42:00恢复时中断CST提示:这可能意味着某些数据已损坏,您必须使用上次备份进行恢复。日志:数据库系统未正确关闭;正在进行自动恢复致命:无法打开目录pg_stat:没有此类文件或目录