卸载服务 sc delete MongoDB 设置服务sc create MongoDB binpath= "D:\Mongo\bin\mongod.exe --dbpath D:\Mongo\data\db --logpath D:\Mongo\data\log\mongodb.log --logappend --auth --service" 启动服务 net start mongodb
进入Mongo交互
bin/mongo admin -u root -p 123456
查看mongodb的进程:ps -aux | grep mongo 启动:bin/mongod --config /opt/data/mongodb/data/mongodb.conf 关闭mongodb: bin/mongod --shutdown --dbpath /opt/data/mongodb/data/db use admin db.shutdownServer({force : true})
#启动服务 systemctl start mongodb.service
#关闭服务
systemctl stop mongodb.service
#开机启动
systemctl enable mongodb.service