启动mongodb数据库时,提示错误:
Mon Dec 16 10:40:46.958 [initandlisten] MongoDB starting : pid=7700 port=27017 d
bpath=datadb 64-bit host=hdl-PC
Mon Dec 16 10:40:46.959 [initandlisten] db version v2.4.8
Mon Dec 16 10:40:46.960 [initandlisten] git version: a350fc38922fbda2cec8d5dd842
237b904eafc14
Mon Dec 16 10:40:46.960 [initandlisten] build info: windows sys.getwindowsversio
n(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST
_LIB_VERSION=1_49
Mon Dec 16 10:40:46.961 [initandlisten] allocator: system
Mon Dec 16 10:40:46.961 [initandlisten] options: { repair: true }
Mon Dec 16 10:40:46.963 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (datadb) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
Mon Dec 16 10:40:46.965 dbexit:
Mon Dec 16 10:40:46.965 [initandlisten] shutdown: going to close listening socke
ts...
Mon Dec 16 10:40:46.966 [initandlisten] shutdown: going to flush diaglog...
Mon Dec 16 10:40:46.966 [initandlisten] shutdown: going to close sockets...
Mon Dec 16 10:40:46.966 [initandlisten] shutdown: waiting for fs preallocator...
Mon Dec 16 10:40:46.967 [initandlisten] shutdown: closing all files...
Mon Dec 16 10:40:46.967 [initandlisten] closeAllFiles() finished
Mon Dec 16 10:40:46.968 dbexit: really exiting now
创建mongod.cfg,输入:
如果以上不能解决,则看下是否把data那个文件删掉了。
另外,也可能是你的机器是32位系统,建议在64位机上运行。
mongodb的这个错误,有时很折磨人,祝你好运。