mongodb 如何在 Windows 7 上设置 mongo db dbpath?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8531893/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set mongo db dbpath on windows 7?
提问by Shreyash
How do I set mongo db dbpath on windows 7? I created a directory in my my C drive as data/db but it is not working.
如何在 Windows 7 上设置 mongo db dbpath?我在我的 C 驱动器中创建了一个目录作为 data/db 但它不起作用。
回答by lig
The mongodb data dir is not application specific. It is mongod.exe
process specific.
mongodb 数据目录不是特定于应用程序的。它是mongod.exe
特定于过程的。
As documentationsays
正如文档所说
By default MongoDB will store data in \data\db, but it won't automatically create that folder, so we do so here:
C:\> mkdir \data C:\> mkdir \data\db Or you can do this from the Windows Explorer, of course.
If you prefer to place datafiles elsewhere, use the --dbpath command line parameter when starting mongod.exe.
默认情况下,MongoDB 会将数据存储在 \data\db 中,但它不会自动创建该文件夹,因此我们在这里这样做:
C:\> mkdir \data C:\> mkdir \data\db Or you can do this from the Windows Explorer, of course.
如果您更喜欢将数据文件放在其他地方,请在启动 mongod.exe 时使用 --dbpath 命令行参数。
This means that you need to create C:\data\db
directory or start mongod.exe
with the full path to your data dir as --dbpath
parameter value.
这意味着您需要创建C:\data\db
目录或mongod.exe
以数据目录的完整路径作为--dbpath
参数值开始。
回答by Michael
Additionally add
另外添加
C:\Program Files\MongoDB\Server.0\bin;
to your Path variable.
到您的 Path 变量。
回答by joelengt
--> in the path of windows paste url install for example: C:/mongodb/bin
-->here mongod.exe and mongo.exe
--> 在windows的路径中粘贴url install 例如:C:/mongodb/bin
-->这里是mongod.exe和mongo.exe
add C:/mongodb/bin
添加 C:/mongodb/bin
open cmd, write: mongod open other cmd,write mongo
打开cmd,写:mongod 打开其他cmd,写mongo
enjoy :)
请享用 :)
PD: It's the same for other python, ruby etc. Windows is hurts T_T haha
PD:其他python、ruby等也是一样的,windows好疼T_T哈哈