guys i am trying to start mongod
service with authentication , it ask me to give the database path , so i pass a config parameter with the following , putting in mind that i am already in the directory of the mongod
service C:\\Program Files\\MongoDB\\Server\\4.2\\bin
mongod --auth --config "C:\Program Files\MongoDB\Server\4.2\bin\mongod.cfg"
as the configuration file has the dbpath
, but cmd
get stuck
here is the configuration file
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: C:\Program Files\MongoDB\Server\4.2\data
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: C:\Program Files\MongoDB\Server\4.2\log\mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
#processManagement:
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
Add these to your config file:
processManagement:
windowsService:
serviceName: MongoDB
displayName: MongoDB
description: MongoDB Server - Standalone DB
security:
authorization: enabled
Then you can install the service with this command:
mongod.exe --config "C:\Program Files\MongoDB\Server\4.2\bin\mongod.cfg" --install
After you created the service, you cas start either from "Service" or by command line with
net start MongoDB
In order to stop/remove a service (entirely!) run
net stop MongoDB
sc config MongoDB start=disabled
mongod.exe --config "C:\Program Files\MongoDB\Server\4.2\bin\mongod.cfg" --remove
rmdir /S "C:\Program Files\MongoDB\Server\4.2\data"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.