vim /etc/mongodb.conf
firewall-cmd --zone=public --permanent --add-port=27017/tcp
firewall-cmd --reload
重启mongod
./mongod --dbpath=/home/data --bind_ip 0.0.0.0
添加用户名、密码:
db.createUser({user:'bo',pwd:'123456',roles:['userAdminAnyDatabase']})
查看用户:
db.system.users.find().pretty()