Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>
1: Mongovue was unable to create collections
The new storage engine of mongodb is wiredtiger. Under this storage engine, we can’t see the collection with the visualization tool mongovue. We should replace it with mmapv1 engine
1. Delete the data folder and recreate the data folder
2. Next, execute mongod — storageengine mmapv1 — dbpath D::?Office?Mongodb?Data
2: Mongovue cannot log in with user name and password
There are two authentication mechanisms in mongodb: scrum-sha-1 and mongodb-cr. After version 3.0, the default is: scrum-sha-1; 2. Spring mongodb defaults to mongodb-cr and does not support setting authentication mode; Solution: modify the authentication method of mongodb
1. View auth authentication method
use admin
db.system.version.findOne({“_ id”:”authSchema”})
(return to {“_ id” : “authSchema”, “currentVersion” : 3 } currentVersion 3:MONGODB-CR currentVersion 5:SCRAM-SHA-1)
2. Delete all previously set users
db.system.users.remove({})
3. Delete the original auth authentication method and set it to mongodb-cr
db.system.version.remove({})
db.system.version.insert({“_ id”:”authSchema”,”currentVersion”:3})
4. Add admin user again (super administrator)
use admin
db.createUser({user:”admin”,pwd:”admin”,roles:[{role:”readWriteAnyDatabase”,db:”admin”}]})
5. Create a new test database and set users and roles (permissions) for the test database
use test
db.createUser({user:”test”,pwd:”test”,roles:[{role:”dbOwner”,db:”test”}]})
3: The admin library cannot view collections
Change the role to readwriteanydatabase
db.updateUser(“root”,{roles:[{role:”readWriteAnyDatabase”,db:”admin”}]})
4: Enable user authentication
Method 1: on the command line, enter mongod — auth — logpath “D: office, mongodb, log. Mongod. Log” — dbpath “D: office, mongodb, data” — reinstall
method 2: on the command line, enter mongod — dbpath “D: office, mongodb, data” — logpath “D: office, mongodb, log. Mongod. Log” — auth
5: Turn off user authentication
mongod –logpath “D:\office\MongoDB\log.mongod.log” –dbpath “D:\office\MongoDB\data” –reinstall
7: Forget the password
Once you forget the admin password, you can turn off user authentication, delete the user and recreate it
6: Login
1:mongo
2:use admin
3:db.auth(“root”,”root”)