mac 安装 mongodb
所属分类 mongodb
浏览量 212
The easiest way to get started with MongoDB on the Mac
https://github.com/gcollazo/mongodbapp
brew install --cask gcollazo-mongodb
安装命令行
brew install mongosh
/opt/homebrew/Cellar/mongosh/2.2.6
./mongosh
show dbs
use admin
创建用户
db.createUser({ user: "admin", pwd: "123456", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] })
db.createUser({user: "root",pwd: "123456", roles: [ { role: "root", db: "admin" } ]})
创建数据库 db001
use db001
不存在则创建
创建集合并insert一条记录 (自动创建集合 c001)
db.c001.insertOne({ name: "doc001" });
创建用户
db.createUser({user: "user001",pwd: "123456",roles: [ { role: "dbOwner", db: "db001" } ]})
show collections;
db.c001.find()
db.c001.find({'name':'doc001'})
mongodb://user001:123456@127.0.0.1:27017/db001
上一篇
下一篇
kafka auto.offset.reset 和 StartingOffsets
AI 工具
ChatGPT Midjourney与Stable Diffusion
mongo shell 常用命令
MongoDB 和 Redis
centos7 安装 mongodb