您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页mac环境下mongodb无法启动

mac环境下mongodb无法启动

来源:二三娱乐

解决方法1

原因:mongodb没有启动

用brew service来启动

brew services start mongodb

解决方法2

原因:没有db文件夹

Before you start MongoDB for the first time, create the directory to which the mongod process will 
write data. By default, the mongod process uses the /data/db directory. If you create a directory other
than this one, you must specify that directory in the dbpath option when starting the mongod process
later in this procedure.
1. 创建文件夹
mkdir -p /data/db
2. 给文件夹设置可写
sudo chown -R `id -un` /data/db
3. 运行mongodb
cd /usr/local/mongodb/bin
mongod
mongo
4. 结束运行mongodb
Control+C

解决方法3

原因:因意外造成Mongodb服务非正常关闭且造成Mongod服务无法正常启动

删除data目录下的*.lock文件

sudo rm /data/db/mongod.lock
sudo rm /data/db/WiredTiger.lock
然后再启动Mongod服务
cd /usr/local/mongodb/bin
mongod
mongo
如果还是不行,可以查看一下进程,然后杀掉:
ps -aef | grep mongo 
kill ***
cd /usr/local/mongodb/bin
mongod
mongo

解决方法4

原因:Permission denied

cd /usr/local/mongodb/bin
sudo mongod

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务