mongoDB windows安装

    技术2022-05-19  32

    mongoDB windows安装(已测试成功)

    mongodb 主页 http://www.mongodb.org/

    1:下载http://www.mongodb.org/display/DOCS/Downloads 选择你要下载的版本

    2:将一个DB文件夹 我是放到D盘,路径d:/db

    3: 设置存放数据库文件的路径

    进入 cmd 提示符控制台

    D:/mongodb/bin> mongod.exe --dbpath=d:/DB/data

    (这个cmd不要关了!)

    4:新打开一个CMD输入:d:/mongodb/bin>mongo.exe,如果出现下面提示,恭喜你安装成功了,很简单吧

     

    D:/mongodb/bin>d:/mongodb/bin/mongo.exeMongoDB shell version: 1.4.0url: testconnecting to: testtype "exit" to exittype "help" for help>

     

    5:D:/mongodb/bin>mongod.exe --dbpath d:/DB/data --logpath D:/mongodb/log/mongo.log -install 注册windows service,免得以后麻烦,每次要启动

    D:/mongodb/bin>mongo.exeMongoDB shell version: 1.4.0url: testconnecting to: testtype "exit" to exittype "help" for help> use testswitched to db test> db.foo.save({hello:1,word:2})> db.foo.find(){ "_id" : ObjectId("4bc1854e0140000000006f05"), "hello" : 1, "word" : 2 }


    最新回复(0)