标签:mongodb
groupadd -g 800 mongodbcd /root/
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.6.4.tgz
tar xf mongodb-linux-x86_64-rhel62-3.6.4.tgz
cd mongodb-linux-x86_64-rhel62-3.6.4
cp * /usr/local/mongodb
cd /usr/local
chown -R mongodb.mongodb mongodb/
cd /root/
vi .bash_profile
export PATH=/mongodb/bin:$PATH
source .bash_profile
vim /usr/local/mongodb/conf/mongodb.conf
logpath=/usr/local/mongodb/log/mongodb.log
dbpath=/usr/local/mongodb/data
#directoryperdb=true
port=27017
bind_ip=0.0.0.0
logappend=true
fork=true
cpu=true
auth=true
netstat -nputl
mongod -f /usr/local/mongodb/conf/mongodb.conf
mongod --shutdown -f /usr/local/mongodb/conf/mongodb.conf
mongo
db
show dbs
use admin
db.auth("admin","xld.2018")
db.system.users.find()
db.createUser({user:"admin",pwd:"xld.2018",roles:["root"]}) 创建超级管理员
db.createUser({user:"xwgl",pwd:"xld.2018",roles:[{ role: "dbAdmin", db: "xwgl" }]}) 创建单个数据库管理员
标签:mongodb
原文地址:http://blog.51cto.com/zuoshou/2121546