Rya*_*ing 22 ruby postgresql macos ruby-on-rails osx-mavericks
最近升级到OSX Mavericks已经破坏了我的Rails应用程序的数据库连接.
当我尝试从数据库中提取时,服务器返回以下错误:
PG::ConnectionBad (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?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
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)
我已尝试过互联网上提供的许多解决方案.这样重新安装pg gem并在我的database.yml中设置host:localhost.我的/usr/local/var/postgres/pg_hba.conf文件说:
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication RyanKing trust
#host replication RyanKing 127.0.0.1/32 trust
#host replication RyanKing ::1/128 trust
Run Code Online (Sandbox Code Playgroud)
哪个psql返回: /usr/local/bin/psql
对此有何解决方案?一些解决方案建议我需要将我的$ PATH更改为我以前的postgres安装,因为新版本的postgres将与Mavericks一起添加.我如何找到它的位置?它很可能是用自制软件安装的,但我不确定.
Doo*_*oon 23
如果你通过自制软件安装它,试试这个(来自brew info postgresql)
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Run Code Online (Sandbox Code Playgroud)
哪个会重新加载它.Postgress.app我的默认设置将找不到您的数据库(您需要将其指向PGDATA目录,并且您可能会遇到版本冲突(如果您运行9.2并且postgress.app为9.3,则转储/恢复将按顺序进行).
从评论中提取.
好吧所以看起来你安装了9.2.3,我会做的就是这个.
postgres -D /usr/local/var/postgres
Run Code Online (Sandbox Code Playgroud)
然后把它们全部拿回来. pg_dumpall > ~/mydatabases.dump
杀死postgres
a brew reinstall postgresql,但警告这会带你9.2.3到9.3.1.然后重新导入所有数据库psql < mydatabaes.dump.确保遵循卸载/加载启动项目的指示,此时你应该是好的.您还可以查看使用postgress.app并将数据库导入该应用程序,但无论如何您还需要备份/转储数据库.
tl; dr刚启动Postgres应用程序!
FWIW,在我的小牛队升级之后和之后我获得了完全相同的体验:
然后我回去了:
一切正常!
然后我意识到了
| 归档时间: |
|
| 查看次数: |
29651 次 |
| 最近记录: |