mac环境下mongodb无法启动

424次阅读
没有评论

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
神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:MongoDB2022-12-06发表,共计857字。
新手QQ群:570568346,欢迎进群讨论 Python51学习