MongoDB入门(配置与启动)

用Dos命令先进入MongoDB路径\bin,然后

mongod.exe --dbpath D:\database(此处输入数据库物理位置)

配置好--dbpath后,直接启动Mongo.exe

开始用Mongo Shell

1. show dbs

2. use *** (使用某个db)

   然后显示  switched to db ***

3. show collections

  

4. 然后插入,查询,各种操作走起来。

 

但是,use admin 然后用service iptables stop关闭后

第二次Dos启动,没有输入--dbpath ***(路径)

结果就是另外一个路径下的数据

 

因此如果自定义了数据路径,在用Dos启动Mongod.exe的时候一定要加上 --dbpath ***

posted @ 2017-09-15 14:04  JokerJason  阅读(144)  评论(0)    收藏  举报

It's not who you are underneath, it's what you do that defines you

Brick walls are there for a reason :they let us prove how badly we want things