MongoDB?????????????????????
???????????? ???????[ 2015/10/27 11:07:20 ] ????????MongoDB ?????
???????????MongoDB??????????????????????????????????????mongo???????????????shell??????в??????????????????????????????о????????????????????????????????????????????ū?????????????£?
???????????????????????????
????mongod --install --dbpath "C:Program Filesmongodbdatadb" --logpath "C:Program FilesmongodbdatalogMongoDB.log"
???????£?
????c:Program Filesmongodbin>mongod --install --dbpath "C:Program Filesmongodbdatadb" --logpath "C:Program FilesmongodbdatalogMongoDB.log"
????Fri Apr 05 13:47:43.164
????Fri Apr 05 13:47:43.168 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
????Fri Apr 05 13:47:43.169
????Fri Apr 05 13:47:43.169 Trying to install Windows service 'MongoDB'
????Fri Apr 05 13:47:43.170 There is already a service named 'MongoDB'?? aborting
????c:Program Filesmongodbin>net start MongoDB
????Mongo DB ????????????????????????????????
????c:Program Filesmongodbin>mongo
????MongoDB shell version: 2.4.1
????connecting to: test
????Server has startup warnings:
????Fri Apr 05 13:48:02.516 [initandlisten]
????Fri Apr 05 13:48:02.516 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.
????Fri Apr 05 13:48:02.516 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).
????Fri Apr 05 13:48:02.516 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.
????Fri Apr 05 13:48:02.516 [initandlisten] ** See http://dochub.mongodb.org/core/32bit
????Fri Apr 05 13:48:02.516 [initandlisten]
????> show dbs
????admin (empty)
????local 0.03125GB
????>
??????????????????????????admin??local
???????1???????????????root???????admin??????????£?
????> use admin
????switched to db admin
????> db.addUser("root"??"admin")
????{
????"user" : "root"??
????"readOnly" : false??
????"pwd" : "bde0d84f6749c235a6b4e36d945eb666"??
????"_id" : ObjectId("515e662430d89f61f6991c91")
????}
????> show collections
????Fri Apr 05 13:50:36.685 JavaScript execution failed: error: {
????"$err" : "not authorized for query on admin.system.namespaces"??
????"code" : 16550
????} at src/mongo/shell/query.js:L128
????>
???????????????????show collections????????????????????????????????2?????
????> db.auth("root"??"admin");
????1
?????????????1????????????????0??????????
????????????????????show collections????????admin?μ???????
????> show collections
????system.indexes
????system.users
????> db.system.users.find()
????{ "_id" : ObjectId("515e662430d89f61f6991c91")?? "user" : "root"?? "readOnly" : false?? "pwd" : "bde0d84f6749c235a6b4e36d945eb666" }
????>
???????2??????????root???????admin??????′??????student?????????student??????д??????stu?????????????????????£?
????> use student
????switched to db student
????> db.stu.insert({"name":"maoyuanjun"??"age":25??"sex":"male"})
????> db.stu.find()
????{ "_id" : ObjectId("515e676630d89f61f6991c92")?? "name" : "maoyuanjun"?? "age" : 25?? "sex" : "male" }
??????????????????μ?????£?
????c:Program Filesmongodbin>mongo
????MongoDB shell version: 2.4.1
????connecting to: test
????> show dbs
????Fri Apr 05 13:58:05.420 JavaScript execution failed: listDatabases failed:{ "ok" : 0?? "errmsg" : "unauthorized" }
????at src/mongo/shell/mongo.js:L46
?????????????????????????ж?????????????£?
????> use admin
????switched to db admin
????> db.auth("root"??"admin")
????1
????> show dbs
????admin 0.0625GB
????local 0.03125GB
????student 0.0625GB
????>
??????????????????????root??????admin?????????????student?????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11