首页 养生问答 疾病百科 养生资讯 女性养生 男性养生

mongodb本地怎么连接数据库

发布网友 发布时间:2022-04-21 23:04

我来回答

1个回答

热心网友 时间:2022-04-08 09:40

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)

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com