首先 執(zhí)行 `mongod`,查看mongo的版本號,下面第二部要用到,假設你的mongo版本號為3.4.4
然后依次執(zhí)行下面3個命令
1. mkdir -p ~/Library/LaunchAgents
2. cp /usr/local/Cellar/mongodb/3.4.4/homebrew.mxcl.mongodb.plist ~/Library/LaunchAgents/
3. launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
然后mongod在你開機時就會自動啟動了
windows 用戶
第一步:
mongod --dbpath "D:\path\to\db" --logpath "D:\path\to\log\mongo.log" --serviceName "MongoDB" --install
第二步:
net start MongoDB
如何刪除:
sc delete MongoDB