mongoDB在windows下安装方法

(1) 首先去官网下载mongoDB for windows zip包
http://www.mongodb.org/downloads

(2) 把mongoDB解压缩到:E:\WebTools\mongodb-win32-i386-1.8.2
并新建“log.txt”日志文件。新建“db”文件夹。

(3) 为mongoDB加载服务,并记录日志文件,并修改mondb安装路径:
E:\WebTools\mongodb-win32-i386-1.8.2\bin>mongod.exe --install --logpath=E:\WebTools\mongodb-win32-i386-1.8.2\log.txt --dbpath=E:\WebTools\mongodb-win32-i386-1.8.2\db

all output going to: E:\WebTools\mongodb-win32-i386-1.8.2\log.txt
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB"'.

E:\WebTools\mongodb-win32-i386-1.8.2\bin>

(4) 启动mongoDB服务:
E:\WebTools\mongodb-win32-i386-1.8.2\bin>net start mongodb

Mongo DB 服务已经启动成功。

E:\WebTools\mongodb-win32-i386-1.8.2\bin>

(5) 完成!进入mongoDB啦:
E:\WebTools\mongodb-win32-i386-1.8.2\bin>mongo
MongoDB shell version: 1.8.2
connecting to: test
> 3+3
6
> db
test
> help
        db.help()                    help on db methods
        db.mycoll.help()             help on collection methods
        rs.help()                    help on replica set methods
        help connect                 connecting to a db help
        help admin                   administrative help
        help misc                    misc things to know
        help mr                      mapreduce help

        show dbs                     show database names
        show collections             show collections in current database
        show users                   show users in current database
        show profile                 show most recent system.profile entries with time >= 1ms
        use <db_name>                set current database
        db.foo.find()                list objects in collection foo
        db.foo.find( { a : 1 } )     list objects in foo where a == 1
        it                           result of the last line evaluated; use to further iterate
        DBQuery.shellBatchSize = x   set default number of items to display on shell
        exit                         quit the mongo shell
> exit
bye

E:\WebTools\mongodb-win32-i386-1.8.2\bin>


你可能感兴趣的:(mongodb)