1. bin目录mongod.cfg更改绑定ip为0.0.0.0,不做限制
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
2. 关闭服务再启动
net stop mongodb
net start mongodb
3. mongo登录
4. use admin切换用户
5. 添加远程用户
db.createUser({user:"admin",pwd:"123456",roles:[{"role":"userAdminAnyDatabase","db":"admin"},{"role":"readWrite","db":"test"}]})
6. 换一台电脑远程登录
mongo 192.168.0.1:27017/admin -u admin -p 123456