1. Configure the MONGODB environment variable, after the configuration is completed, you can directly execute Mong, mongod and other common commands, not every time to the MongoDB installation directory bin down execution;
2. Start the MONGO service by command
Mongod--dbpath = D:\mongodb\data\db--logpath = D:\mongodb\data\log\mongod.log
3. Each time through the command to start mongod too troublesome, then register system services
Mongod--install--dbpath = D:\mongodb\data\db--logpath = D:\mongodb\data\log\mongod.log
Once the registration is complete, you can find the MongoDB service in the system service, so you don't have to start the service with the command line every time.
4. Start the MONGO service through the configuration file, the configuration file needs to be created by itself, only need to develop your own configuration file path after-F
Mongod-f D:\mongodb\conf\mongo.conf
Configuration file content as follows, you can add or modify the configuration file according to your own needs
DBPath = D:\mongodb\data\dblogpath = D:\mongodb\data\log\mongod.loglogappend = Trueport = 27017
5. The configuration file registration service is similar to the direct development of DBPath and LogPath, except that the parameter information is in the configuration file
Mongod--install-f D:\mongodb\conf\mongo.conf
The net start and net stop command can be used to start or stop the MONGO service after the service registration is complete, which is not much easier
MongoDB starts and registers the service through the configuration file