时间:2022-12-10 12:10:31 | 栏目:mongodb | 点击:次
// 开启mongodb 服务 net start mongodb // 连接数据库 mongo
show dbs
use admin
db.createUser({user: 'xxx', pwd: '123456', roles: ['root']})
use blog
db.createUser({user: 'xxx', pwd: '123456', roles: ['readWrite']})
net stop mongodb
mongod --remove
mongod --logpath='C:\Program Files\MongoDB\Server\5.0\log\mongod.log' --dbpath='C:\Program Files\MongoDB\Server\5.0\data' --install --auth
net start mongodb
mongodb://xxx:123456@localhost/blog
mongodb:管理员账号:管理员密码@localhost
mongo localhost/-u 'ganjp' -p '123456'