美文网首页
macOS 下 MongoDB 的安装与配置

macOS 下 MongoDB 的安装与配置

作者: __Naraku | 来源:发表于2017-10-12 10:13 被阅读0次

    安装

    更新 Homebrew

    ~ brew update
    

    使用 Homebrew 安装 MongoDB 并等待安装完毕

    ~ brew install mongodb
    

    配置运行

    安装结束有提示运行的方法 mongod --config /usr/local/etc/mongod.conf,此为配置文件

    systemLog:
      destination: file
      # 日志地址
      path: /usr/local/var/log/mongodb/mongo.log
      logAppend: true
    storage:
      # 数据库读写目录
      dbPath: /usr/local/var/mongodb
    net:
      # 监听 host
      bindIp: 127.0.0.1
    

    测试一下,保持执行 mongod 的终端窗口,新建窗口执行命令 mongo

    执行

    > show dbs
    admin  0.000GB
    local  0.000GB
    > use test
    switched to db test
    > db.test.insert({'name':'Josh'})
    WriteResult({ "nInserted" : 1 })
    > db.test.find()
    { "_id" : ObjectId("5985d0a015714f48c2655e57"), "name" : "Josh" }
    

    图形操作管理软件可以选择 Studio 3T

    以上

    相关文章

      网友评论

          本文标题:macOS 下 MongoDB 的安装与配置

          本文链接:https://www.haomeiwen.com/subject/qfsnyxtx.html