gpt4 book ai didi

ruby-on-rails - 在 Mountain Lion 上使用 Homebrew 和 Rails 安装 postgresql

转载 作者:行者123 更新时间:2023-11-29 11:24:15 24 4
gpt4 key购买 nike

我在计算机上安装 Postgresql 时遇到了很多问题。

我有一个部署到 Heroku 的 Rails 应用程序,我想在我的本地机器上使用 Postgresql。在我下载 Postgres.app 但从未真正使用过它之前,我最近卸载了它,认为它可能会导致一些问题。

我安装了 Postgres,每次运行 rake db:create:all 时,我都会收到以下错误:

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

我用 Google 搜索并尝试了很多东西,但一直无法弄清楚,我认为我可能最终需要获得一些个人帮助。

当运行 which psql 我得到:

/usr/local/bin/psql

我试过卸载 Postgres、卸载 pg 并重新安装,但没有任何效果。

这里有什么见解吗?谢谢。

最佳答案

如果您使用 Homebrew 软件安装它,您是否安装了启动守护程序以便服务器启动?

查看brew info postgresql

你需要初始化数据库

initdb/usr/local/var/postgres -E utf8

然后启动服务器

pg_ctl -D/usr/local/var/postgres -l/usr/local/var/postgres/server.log 开始

然后您应该能够创建您的数据库,并在本地使用它。如果你打算使用它,你应该按照 brew 中列出的说明自动启动和停止它。

关于ruby-on-rails - 在 Mountain Lion 上使用 Homebrew 和 Rails 安装 postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13538593/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com