In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces you how to modify the database authentication mechanism in MongoDB3.0, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Modification requirements: MongoDB3.0 's current authentication mechanism is SCRAM-SHA-1, which needs to be changed to the old authentication mechanism MONGODB-CR.
The methods are as follows:
> use admin
Switched to db admin
> db.system.version.findOne ({"_ id": "authSchema"})
{"_ id": "authSchema", "currentVersion": 5}
A currentVersion of 5 means that the authentication mechanism of the current database is SCRAM-SHA-1, which needs to be changed to a value of 3 for MONGODB-CR,currentVersion.
> var schema = db.system.version.findOne ({"_ id": "authSchema"})
> schema.currentVersion = 3
three
> db.system.version.save (schema)
WriteResult ({"nMatched": 1, "nUpserted": 0, "nModified": 1})
> db.system.version.find ()
{"_ id": "authSchema", "currentVersion": 3}
Here it means that the modification has been successful.
Create a database user
> use test
> db.createUser ({user: 'test', pwd:' test123', roles: [{role: "readWrite", db: "test"}]})
Successfully added user: {
"user": "test"
"roles": [
{
"role": "userAdminAnyDatabase"
"db": "admin"
}
]
View the authentication method:
> use admin
> db.system.users.find ()
{"_ id": "admin.admin", "user": "admin", "db": "admin", "credentials": {"SCRAM-SHA-1": {"iterationCount": 10000, "salt": "kAyNTjjA56SjKNB+voW/ow==", "storedKey": "S0QMFvrojLTl4fYN4zz6HL3rlRc =", "serverKey": "m0eym4YQikIufcR8JxcIRfdDrg ="}, "roles": [{"role": "userAdminAnyDatabase" "db": "admin"}]}
{"_ id": "test.test", "user": "test", "db": "test", "credentials": {"MONGODB-CR": "cf75a14725e3655983a84ea5f5b25438"}, "roles": [{"role": "readWrite", "db": "test"}]}
On how to modify the database authentication mechanism in MongoDB3.0 to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.