zhuce 发表于 2018-10-24 12:16:48

mongodb3.6.4安装

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

页: [1]
查看完整版本: mongodb3.6.4安装