创建数据目录
代码如下:
$ mkdir -p mongodb/data/db
要确保mongod对数据目录有读写权限。
运行MongoDB(指定建立的数据目录)
$ mkdir -p mongodb/data/db
要确保mongod对数据目录有读写权限。
运行MongoDB(指定建立的数据目录)
代码如下:
$ mongod --dbpath /home/chuser/mongodb/data &
$ mongod --dbpath /home/chuser/mongodb/data &
6、验证MongoDB是否正常运行
代码如下:
$ mongo
MongoDB shell version: 2.6.0
connecting to: test
2014-04-14T03:40:59.560+0000 [initandlisten] connection accepted from 127.0.0.1:39014 #1 (1 connection now open)
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> show databases;
admin (empty)
local 0.078GB
$ mongo
MongoDB shell version: 2.6.0
connecting to: test
2014-04-14T03:40:59.560+0000 [initandlisten] connection accepted from 127.0.0.1:39014 #1 (1 connection now open)
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> show databases;
admin (empty)
local 0.078GB
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。