MongoDB 인증 추가하기

인증하기

$ mongo # 또는
$ mongosh

> use admin
switched to db admin
> show users # 인증해야 사용 가능
MongoError: command usersInfo requires authentication

> db.auth("admin", "admin1234!!") # 인증
{ ok: 1 }

> show users # 사용 가능
[
  {
    _id: 'admin.admin',
    userId: UUID("184a8c56-abe0-4442-aadc-333e1a1d6a78"),
    user: 'admin',
    db: 'admin',
    roles: [ { role: 'admin', db: 'admin' } ],
    mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
  }
]

출처

MongoDB 공식 가이드 – https://docs.mongodb.com/guides/server/auth/


답글 남기기 0

Your email address will not be published. Required fields are marked *