为了账号安全,请及时绑定邮箱和手机立即绑定

mongodb本地怎么连接数据库

mongodb本地怎么连接数据库

慕哥9229398 2019-02-21 14:13:53
mongodb本地怎么连接数据库 
查看完整描述

1 回答

?
德玛西亚99

TA贡献1770条经验 获得超3个赞

1、基于mongo实现远程连接

[plain] view plaincopy

mongo -u admin -p admin 192.168.0.197:27017/pagedb

通过mongo实现连接,可以非常灵活的选择参数选项,参看命令帮助,如下所示:

[plain] view plaincopy

mongo --help
MongoDB shell version: 1.8.3
usage: mongo [options] [db address] [file names (ending in .js)]
db address can be:
foo foo database on local machine
192.169.0.5/foo foo database on 192.168.0.5 machine
192.169.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999
options:
--shell run the shell after executing files
--nodb don't connect to mongod on startup - no 'db address'
arg expected
--quiet be less chatty
--port arg port to connect to
--host arg server to connect to
--eval arg evaluate javascript
-u [ --username ] arg username for authentication
-p [ --password ] arg password for authentication
-h [ --help ] show this usage information
--version show version information
--verbose increase verbosity
--ipv6 enable IPv6 support (disabled by default)



查看完整回答
反对 回复 2019-03-02
  • 1 回答
  • 0 关注
  • 1507 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信