When you install MongoDB, use MongoDB as the system service to start the net start MongoDB, error occurs system errors 2 The system cannot find the file specified.
The reason for this is because the executable file address of the system service is incorrect. Modify the service address to restore!
Summarize how to install MongoDB as a system service under WinXP.
The following commands are used:
C:\Documents and Settings\administrator>mongod-dbpath C:\mongo\MongoDB\mongo\data--logpath=c:\mongo\mongodb\ Mongo\logs\mongodb.log--auth--install
All output Going To:c:\mongo\mongodb\mongo\logs\mongodb.log
However, you cannot connect:
C:\Documents and Settings\administrator>mongo
MongoDB Shell version:2.0.1
Connecting To:test
Tue 18:07:50 error:couldn ' t connect to server 127.0.0.1 Shell/mongo.js:8
4
Exception:connect failed
Looking at the log, you also need to use the net start MongoDB command to start the service, the log is as follows:
Creating service MongoDB.
Service creation successful.
Service can is started from the command line via ' net start ' MongoDB '.
Tue 18:06:43 dbexit:
Tue 18:06:43 shutdown:going to close listening sockets ...
Tue 18:06:43 shutdown:going to flush Diaglog ...
Tue 18:06:43 shutdown:going to close sockets ...
Tue 18:06:43 shutdown:waiting for FS preallocator ...
Tue 18:06:43 shutdown:closing All Files ...
Tue may 18:06:43 Closeallfiles () finished
Tue 18:06:43 dbexit:really exiting now
Follow the prompts to run net start MongoDB under cmd
net start "MongoDB"
C:\Documents and Settings\administrator>net start MongoDB
System error 2 has occurred.
The system cannot find the file specified.
Check out the services you just installed via the Control Panel – Management tools – service:
Somehow the path to the Mongod command becomes C:\Documents and settings\administrator\ as follows:
"C:\Documents and Settings\administrator\mongod"-dbpath C:\mongo\MongoDB\mongo\data--logpath=c:\mongo\mongodb\ Mongo\logs\mongodb.log--auth--service
Specify the path of the Mongod and reinstall:
C:\mongo\mongodb\mongo\bin>c:\mongo\mongodb\mongo\bin\mongod-dbpath C:\mongo\MongoDB\mongo\data--logpath=c:\ Mongo\mongodb\mongo\logs\mongodb.log--auth--install
All output Going To:c:\mongo\mongodb\mongo\logs\mongodb.log
Net start MongoDB occurs system error 2 The system cannot find the file specified