美文网首页
MonogDB 设置明文密码

MonogDB 设置明文密码

作者: 嗚嗚雲 | 来源:发表于2022-07-26 10:25 被阅读0次

设置超级管理员账号密码

  • 首先选择
    use admin
  • 设置操作的用户名密码
    db.createUser({user: 'root', pwd: 'pass123*', roles: ['root']})
  • 密码认证
    db.auth('root', 'pass123*')

给单独某个库设置密码

  • 首先选择数据库
    use test_db
  • 再创建用户
    db.createUser({user:"user",pwd:"12345", roles:[{role: 'readWrite',db: 'test_db'}]})

以下操作要看用户加载了那个库,在那个库里操作

  • 删除用户
    db.dropUser('selena')
  • 修改用户密码
    db.updateUser('admin', {pwd: '654321'})

修改配置文件启用明文密码(需要重启服务)

  • 配置文件 /etc/mongod.conf
 # mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /data/mongo/logs/mongod.log

# Where and how to store data.
storage:
  dbPath: /data/mongo/data
  journal:
    enabled: true
#  engine:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  # fork and run in background
  pidFilePath: /var/run/mongodb/mongod.pid  # location of pidfile
  timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
  port: 27017
  bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
  #bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

# 这里是开启密码后需要开启的配置
security:
    authorization: enabled

#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:

相关文章

  • MonogDB 设置明文密码

    设置超级管理员账号密码 首先选择use admin 设置操作的用户名密码db.createUser({user: ...

  • 锐捷实战系列(九) 明文enable(特权)密码

    实训目的 掌握明文enable(特权)密码的配置。 实训背景 交换机/路由器都可以设置密码,设置密码可以有效提高设...

  • Golang 实现凯撒密码

    一.凯撒密码加密代码思路 基本思路:设置明文 和 位移步长(秘钥)将明文转成小写,准备 明文字节切片 与 密文切片...

  • Kerberos

    使用密码作为认证方式的弊端  1.人为问题:设置的密码容易破解  2.技术问题:网络中明文传输密码不安全 Kerb...

  • 查看密码明文

    查看密码明文 1、浏览器进入路由,打开WAN口设置页面; 2、Chrome浏览器下,选择带星号的密码栏,右键点击“...

  • Dockerfile 配置 ssh 登陆 root 用户(免密

    设置用户的密码: 但是这个密码不能是明文的,得是加密后的,有两个办法: 登陆到容器内部运行 passwd root...

  • 谈谈证书与https的通信过程

    密码、明文、密文 密码:计算机术语『密码 cipher』是一种用于加密或者解密的算法。 明文(plaintext)...

  • 对称加密一:DES&go实现

    密码技术### 1. 介绍 1.1 加密/解密三要素: 明文/ 密文, 秘钥, 密码算法 明文/密文:加密之前...

  • Android设置密码的明文与暗文

    因为项目中用到了这块,所以记录一下!先看下需要实现的效果: 先看下布局排版,RelativeLayout里面放置一...

  • wrs-gesturelockview

    前言 手势密码控件,支持密码设置、密码修改、密码校验 功能 支持密码设置、密码修改、密码校验 密码设置或修改回调,...

网友评论

      本文标题:MonogDB 设置明文密码

      本文链接:https://www.haomeiwen.com/subject/ktkoirtx.html