mongo

数据库-MongoDB篇

May 15, 2018
note, db
mongo, databases, mysql, learning

DB数据库 🖥 📊🖥 # MongoDB笔记 # 学习网站:http://www.runoob.com/mongodb/mongodb-tutorial.html (其学习教程还挺可观,很多,不过还不清楚好不好) 安装 # Docker 安装 4.4.12版本 # pull: docker pull mongo:4.4.13 run: docker run -itd --name mongo --restart=always \ -v /mongodb/datadb:/data/db \ -p 27017:27017 \ --network websafe-network \ --privileged=true mongo:4.4.12 进入容器docker exec -it mongo bash后: mongo use admin # db.createUser({user: "admin", pwd: "admin", roles: [{role: "root", db: "admin"}]}) # db.createUser({user: "admin", pwd: "admin", roles: [{role: "userAdminAnyDatabase", db: "admin"}]}) # 如果能auth就不用createUser了 db.auth("admin", "admin") 网上传的将 MONGO_INITDB_ROOT_PASSWORD 和 MONGO_INITDB_ROOT_USERNAME传入环境变量的方式,在mongo4. ...