mongodb 远程连接 详解

mongodb远程连接配配置,分以下4步。

添加管理员账

> use admin
switched to db admin
> db.addUser('tank','test');

配置mongodb.conf

#bind_ip = 127.0.0.1     //注释此行
auth = true              //将此行前的注释去掉

重启mongodb

/etc/init.d/mongod

防火墙开放27017端口

iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 27017 -j ACCEPT  

测试

mongodb 远程连接 详解

相关的文章:

暂无评论

写评论