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)05/31 Report--
This article is about how to solve the problem of Mongodb 3.2.9 enabling user rights authentication. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. In the old version of Mongodb (before 3.0), you can enable authentication as follows:
1. Mongo shell authentication in Linux environment:
> show dbs # # see the following data admin (empty) comment 0.203125GB dbtest (empty) foo 0.203125GB local (empty) test 0.203125GB > use admin switched to db admin > db.addUser ('admin','12345678') # # add user Mon Nov 5 23:40:00 [FileAllocator] allocating new datafile / data/db/admin.ns, filling with zeroes... {"user": "admin", "readOnly": false, "pwd": "89e41c6c28d88d42c21fe501d82969ea", "_ id": ObjectId ("5097ddd00342c63efff3fbfb")} # # then run > showdbs Mon Nov 5 23:45:13 uncaught exception: listDatabases failed: {"errmsg": "need to login", "ok": 0} # # prompt to log in and add-auth startup. / mongod-auth. / mongo > use admin switched to db admin > db.auth ('admin') '12345678') # # View Mon Nov 5 23:49:32 with the added account password [conn56] authenticate db: admin {authenticate: 1, nonce: "304f5242601fafa4", user: "admin", key: "58260df384b1146466efca5c90a5ff05"} 1 # 1 indicates login is successful > show dbs admin 0.203125GB comment 0.203125GB dbtest (empty) foo 0.203125GB local (empty) test 0.203125GB > use admin switched to db admin > show collections System.indexes system.users > db.system.users.find () # # find data {"_ id": ObjectId ("5097ddd00342c63efff3fbfb"), "user": "admin", "readOnly": false, "pwd": "89e41c6c28d88d42c21fe501d82969ea"}
2. Php code connection authentication:
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
© 2024 shulou.com SLNews company. All rights reserved.