**
Ubuntu启动MongoDB报错:Failed to start mongod.service: Unit mongod.service is not loaded properly
**mongodb
命令行输入如下,打开mongodb.service文件(没有则自动建立)vim
sudo vim /etc/systemd/system/mongodb.service
ui
将如下内容粘贴复制至打开的文件命令行
[Unit] Description=High-performance, schema-free document-oriented database After=network.target [Service] User=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf [Install] WantedBy=multi-user.target
如下命令即可按照本身的意志正常使用
启动:sudo service mongod start
中止:sudo service mongod stop
重启:sudo service mongod restartrest
若是不行旧换一种启动方式:code
sudo systemctl start mongodb
pgrep mongo -l
看到以下输出,表明启动成功orm
root:pgrep mongo -l 10531 mongod