cd ~
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.0.tgz
tar -zxvf ./mongodb-linux-x86_64-4.0.0.tgz
cd mongodb-linux-x86_64-4.0.0/bin/
ls
cd /opt/
mkdir db
cd db
mkdir data
cd ~/mongodb-linux-x86_64-4.0.0/bin/
./mongod --dbpath /opt/db/data/ --bind_ip 0.0.0.0 --fork --logpath /opt/db/log.log
创建用户:
use admin
db.createUser({user: "test1", pwd: "test1", roles: [{role: "root", db: "admin"}]})
# 或者使用客户端 NoSQLBooster
网友评论