首页 > 解决方案 > 谜团:所有 postgres 数据库都消失了

问题描述

我正在使用 postgresql 数据库开发 Rails 应用程序。

我休息了一下,当我回来时,我的笔记本电脑醒来很慢。在按了几次开/关指纹按钮后,它最终进入了启动序列。这很奇怪,因为我不记得关闭它。

开始后,一切似乎都很正常。我打开了一些应用程序并继续工作。但是,当我尝试运行数据库迁移时,我收到了关于无法连接到服务器的错误。

$ bundle exec rake db:migrate
warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.5-compliant syntax, but you are running 2.6.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
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?
/Users/emerson/.rbenv/versions/2.6.3/bin/bundle:23:in `load'
/Users/emerson/.rbenv/versions/2.6.3/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

我试图用自制软件开始它,但没有运气。我最终阅读了另一个建议安装Postgres 应用程序并使用它来强制它重新启动的问题。起初,该应用程序说“空数据目录”。我点击了“初始化”,它起作用了。而且我不再收到错误的连接错误。但是我以前所有的 postgres 数据库都不见了。

我很困惑。这怎么可能发生?而且几乎没有我的任何互动!Postgres.app 是否一键清除了我以前的所有数据?

标签: postgresqlmacospostgres.app

解决方案


推荐阅读