In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Background: the original MongoDB does not use the authentication method of account password to log in, but uses the non-authentication method. Now it needs to be configured to log in and use it in the way of account password. The configuration steps are as follows:
I. configure users with general permissions
1. Use MongoBooster to connect to the Server of MongoDB
two。 Execute the following script to create the administrative user's account aa
Use admindb.createUser ({user: "aa", pwd: "aa", roles: [{role: "userAdminAnyDatabase", db: "admin"}]})
3. Start server authentication mode, log in to the MongoDb server, add auth=true to the mongodb.config file, and then restart the MongoDB service
4. Use the account aa to connect to the Server of MongoDb in MongoBooster
5. Execute the following script to create a user dfy with read and write permissions for test
Use testdb.createUser ({user: "dfy", pwd: "dfy", roles: [{role: "readWrite", db: "sc"}]})
User: user name, pwd: password, roles: specify user roles, you can use an empty array to set empty roles for new users; in the roles field, you can specify built-in roles and user-defined roles. The characters in role can be selected:
Built-In Roles (built-in roles):
1. Database user roles: read, readWrite
two。 Database management roles: dbAdmin, dbOwner, userAdmin
3. Cluster management roles: clusterAdmin, clusterManager, clusterMonitor, hostManager
4. Backup and restore roles: backup, restore
5. All database roles: readAnyDatabase, readWriteAnyDatabase,userAdminAnyDatabase, dbAdminAnyDatabase
6. Superuser role: root
7. Internal role: _ _ system
Second, create a super user (not recommended)
1. Use MongoBooster to connect to the Server of MongoDB, and execute the following script to create the superuser CC
Use admindb.createUser ({user: "CC", pwd: "CC", roles: [{role: "root", db: "admin"}]})
two。 You can start the authentication mode of the server by following step 3 of configuring normal permissions users. The account CC has the permission of Super Admin.
3. How to use the newly configured MongoDB account password in Web?
On the connection configuration page of MongoBooster, click the To URI button to get the current connection string. The new connection string contains the account password information.
In Web.config, you can replace the original MongoDB connection string with the current new connection string.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
1. Did not restart the library to build the table create table sys.dual (dummy varchar2 (1)
© 2024 shulou.com SLNews company. All rights reserved.