报错信息如下
2019-03-11T07:15:24.407-0700 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] MongoDB starting : pid=18444 port=27017 dbpath=D:mymongodbdatabase 64-bit host=DESKTOP-NQHSLH6
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] db version v4.0.6
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] git version: caa42a1f75a56c7643d0b68d3880444375ec42e3
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] allocator: tcmalloc
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] modules: none
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] build environment:
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] distmod: 2008plus-ssl
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] distarch: x86_64
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] target_arch: x86_64
2019-03-11T07:15:24.411-0700 I CONTROL [initandlisten] options: { storage: { dbPath: "D:mymongodbdatabase" } }
2019-03-11T07:15:24.413-0700 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory D:mymongodbdatabase not found., terminating
2019-03-11T07:15:24.413-0700 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-03-11T07:15:24.413-0700 I CONTROL [initandlisten] now exiting
2019-03-11T07:15:24.413-0700 I CONTROL [initandlisten] shutting down with code:100
MongoDB官网下载安装:https://www.mongodb.com/download-center#community
我下载的是安装包,解压,添加环境变量后,运行mongod --dbpath D:\my\mongodb\database
报错,有两个原因:
1.运行路径不对
运行路径是压缩包解压的bin目录下D:\my\mongodb\mongodb-win32-x86_64-2008plus-ssl-4.0.6\bin
2.命令中的路径要加引号mongod --dbpath "D:\my\mongodb\database"
,不能是mongod --dbpath D:\my\mongodb\database