postgresql - 谜团:所有 postgres 数据库都消失了
问题描述
我正在使用 postgresql 数据库开发 Rails 应用程序。
- macOS 10.15.3
- 红宝石 2.6.3p62
- postgres 12.3
我休息了一下,当我回来时,我的笔记本电脑醒来很慢。在按了几次开/关指纹按钮后,它最终进入了启动序列。这很奇怪,因为我不记得关闭它。
开始后,一切似乎都很正常。我打开了一些应用程序并继续工作。但是,当我尝试运行数据库迁移时,我收到了关于无法连接到服务器的错误。
$ 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 是否一键清除了我以前的所有数据?
解决方案
推荐阅读
- javascript - 将字符串转换为正则表达式时如何保留\
- c++ - 建立头文件和.cc文件之间的关系
- python-3.x - 复合赋值运算符的问题
- android - 我的图片库:prolog 中不允许有内容
- windows - “git init”给出错误“C:/Users/Filler_name/Documents/DNN_TEST/.git:没有这样的文件或目录”
- flutter - 什么是 StatelessWidget?
- angular - 离开完成后如何调用角度动画进入
- php - 覆盖分配给变量的类中的函数
- xamarin - C# 作为 Xamarin Forms 应用程序中的脚本语言?
- html - 无法准确叠加图像(背景 SVG 上方的图像)