zoukankan      html  css  js  c++  java
  • brew install mongodb

    install

    安装请参考:
    https://blog.csdn.net/chanstic/article/details/104371316

    //启动
    brew services start mongodb-community
    //停止
    brew services stop mongodb-community
    //重启
    brew services restart mongodb-community
    

    验证是否启动成功:
    终端输入mongo启动客户端, 最后能到输入mongodb命令的状态,按ctrl+c退出 or quit() ;

    浏览器访问:http://localhost:27017/
    页面提示:It looks like you are trying to access MongoDB over HTTP on the native driver port.

    user

    在终端进入

    1. mongo

    2. 创建一个账号

    use admin
    db.createUser(
      {
        user: "user1",
        pwd: "user1",
        roles: [ { role: "userAdminAnyDatabase", db: "admin" },
        		 { role: "dbAdminAnyDatabase", db: "admin" }, 
                 { role: "readWriteAnyDatabase", db: "admin" }  
               ]
      }
    )
    

    mongo --port 27017 -u "user1" -p "user1" --authenticationDatabase "admin"


    这篇文章对你有帮助吗?作为一名程序工程师,在评论区留下你的困惑或你的见解,大家一起来交流吧!
    微信公众号: Mysticbinary
    Github:https://github.com/Mysticbinary
    本文版权归作者所有,欢迎转载,但未经作者同意请保留此段声明,请在文章页面明显位置给出原文链接
    声明:本文章仅限于讨论网络安全技术,请勿用作任何非法用途,否则后果自负,本人和博客园不承担任何责任!
  • 相关阅读:
    其他
    Win10
    Win10
    面向对象与设计模式
    Git
    Java
    Git
    Git
    Git
    一、I/O操作(File文件对象)
  • 原文地址:https://www.cnblogs.com/mysticbinary/p/14718029.html
Copyright © 2011-2022 走看看