MongoDB 不工作.“错误:dbpath (/data/db) 不存在." [英] MongoDB not working. "ERROR: dbpath (/data/db) does not exist."
本文介绍了MongoDB 不工作.“错误:dbpath (/data/db) 不存在."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试在终端中运行mongod"时出现以下错误.我试过卸载、重新安装和重新启动机器.任何关于如何让它工作的建议都会很棒.
I'm getting the following error when I try to run "mongod" in the terminal. I've tried uninstalling, reinstalling, and restarting the machine. Any suggestions on how to get it working would be amazing.
错误:
dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
旁注:在我收到此错误的同时,Node 也停止在我的机器上工作.
Side note: Node also stopped working on my machine around the same time that I got this error.
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
任何帮助将不胜感激!
推荐答案
这应该可以确保目录设置在正确的位置,以便 Mongo 可以找到它:
This should work to ensure that the directory is set up in the right place so that Mongo can find it:
sudo mkdir -p/data/db/
sudo chown `id -u`/data/db
这篇关于MongoDB 不工作.“错误:dbpath (/data/db) 不存在."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文