首页 > 数据库技术 > 详细

mongodb3.6.4安装

时间:2018-05-29 14:56:49      阅读:230      评论:0      收藏:0      [点我收藏+]
groupadd -g 800 mongodb
useradd -u 801 -g mongodb mongodb
cd /usr/local/
mkdir mongodb
cd mongodb/
#mkdir bin
mkdir conf
mkdir log
mkdir data

cd /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" }]}) 创建单个数据库管理员

mongodb3.6.4安装

原文:http://blog.51cto.com/zuoshou/2121546

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!