我正在尝试安装MongoDB,我收到此错误“数据目录C:\ data \ db \ not found。,终止”

时间:2016-05-10 00:09:02

标签: mongodb nosql

我正在尝试安装MongoDB,但是我遇到了一些困难

C:\Users\HP>mongod
2016-05-09T19:48:32.489-0400 I CONTROL  [initandlisten] MongoDB starting : pid=4
284 port=27017 dbpath=C:\data\db\ 64-bit host=hp_pc
2016-05-09T19:48:32.490-0400 I CONTROL  [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2016-05-09T19:48:32.490-0400 I CONTROL  [initandlisten] db version v3.2.6
2016-05-09T19:48:32.490-0400 I CONTROL  [initandlisten] git version: 05552b562c7
a0b3143a729aaa0838e558dc49b25
2016-05-09T19:48:32.490-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL
 1.0.1p-fips 9 Jul 2015
2016-05-09T19:48:32.490-0400 I CONTROL  [initandlisten] allocator: tcmalloc
2016-05-09T19:48:32.490-0400 I CONTROL  [initandlisten] modules: none
2016-05-09T19:48:32.491-0400 I CONTROL  [initandlisten] build environment:
2016-05-09T19:48:32.491-0400 I CONTROL  [initandlisten]     distmod: 2008plus-ss
l
2016-05-09T19:48:32.491-0400 I CONTROL  [initandlisten]     distarch: x86_64
2016-05-09T19:48:32.491-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2016-05-09T19:48:32.491-0400 I CONTROL  [initandlisten] options: {}
2016-05-09T19:48:32.492-0400 I STORAGE  [initandlisten] exception in initAndList
en: 29 Data directory C:\data\db\ not found., terminating
2016-05-09T19:48:32.493-0400 I CONTROL  [initandlisten] dbexit:  rc: 100
C:\Users\HP>

因此,我决定在DB文件夹中创建db文件夹,然后将其输入命令行

`mongod --dbpath C:\Program Files\MongoDB\Server\3.2\data\db`

然而,我收到错误

Invalid command: Files\MongoDB\Server\3.2\data\db

我已经创建了该文件。我不明白这个问题。

3 个答案:

答案 0 :(得分:6)

您的命令中有一个空格

`mongod --dbpath C:\Program Files\MongoDB\Server\3.2\data\db`

应该是

mongod --dbpath "C:\Program Files\MongoDB\Server\3.2\data\db"

答案 1 :(得分:0)

安装mongodb时会自动创建'test'文件夹。你能看到'test'文件夹吗?如果是,那么请使用以下内容:

C:\Program Files\MongoDB\Server\3.0\bin>mongod.exe --dbpath d:\test\mongodb\data

答案 2 :(得分:0)

您必须从root创建db文件夹。 例如md \ data \ db而不是md data \ db。