Skip to content

Instantly share code, notes, and snippets.

@rlaace423
Created March 21, 2024 02:29
Show Gist options
  • Save rlaace423/86d6bae3b4db741ab548d2de510a4e8e to your computer and use it in GitHub Desktop.
Save rlaace423/86d6bae3b4db741ab548d2de510a4e8e to your computer and use it in GitHub Desktop.
# 계정 추가
use admin
db.createUser({ user: 'root', pwd: 'Hello#$', roles: ['root'] });
use bitcore
db.createUser({ user: 'bitcore', pwd: 'Hello2024#$', roles: ['dbOwner'] });
# 비밀번호 변경
db.changeUserPassword(username, password)
# mongod.conf 변경
security:
authorization: enabled
# 접속 방법
./bin/mongo -u root -p "Hello#$"
./bin/mongo -u bitcore -p "Hello#$" --authenticationDatabase bitcore
# 현재 로그인 계정 확인
db.runCommand({ connectionStatus: 1 })
db.runCommand({ connectionStatus: 1 }).authInfo.authenticatedUserRoles[0].role
# authorization 설정 확인
db.serverCmdLineOpts();
# 새 버전 다운로드
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-5.0.25.tgz
# Feature Compatibility Version 조회
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
# Feature Compatibility Version 변경
db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment