通过迁移助手将我的旧 MacBook Pro 迁移到新机器后,我无法连接到 MongoDB。
我通过 Homebrew 重新安装了它,当我运行时:
brew services start mongodb-community
但是,当我运行以下命令时,终端显示服务已启动:mongo
我收到此错误:
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
2020-04-09T09:20:02.419-0400 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-04-09T09:20:02.419-0400 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
我正在 Medium 上关注这个指南:https://medium.com/better-programming/installing-mongodb-on-macos-catalina-aab1cbe0c836
重新安装 MongoDB。有人能帮我吗?
答案1
迁移后您是否重新安装brew
?升级到 Catalina 后我遇到了很多问题。但是在全新 Catalina(和brew
默认安装)上我:
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
==> Successfully started
mongodb 社区`
您可以尝试:
- 下载 Xcode 命令行
- 重新开始
- 清除
cellar
文件夹和brew cache
brew tap mongodb/brew
或者重新安装完整的 brew 并按照 1-4 进行操作。