mongoDB在windows下安装方法

本文详细介绍了如何在Windows环境下安装并配置MongoDB,包括下载、解压、启动服务及基本操作,帮助开发者快速上手。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

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

[b](3) 为mongoDB加载服务,并记录日志文件,并修改mondb安装路径:[/b]
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>

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

Mongo DB 服务已经启动成功。

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

[b](5) 完成!进入mongoDB啦:[/b]
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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值