• 技术文章 >数据库 >MongoDB

    mac环境下mongodb无法启动

     Ly Ly2020-06-08 14:21:21原创3221

    解决方法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
    专题推荐:mongodb
    品易云
    上一篇:idea怎么配置mongodb 下一篇:mac环境中mongodb启动失败

    相关文章推荐

    • 如何解决win10 mongodb无法启动• 怎么查看mongodb的性能?• 安装完MongoDB找不到文件怎么解决• hive支持mongodb吗• idea怎么配置mongodb

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网