Dev/etc.

7. mongoDB 설치

takeU 2024. 11. 3. 14:05
반응형
# 설치
brew install mongodb-community

# mongoDB 커맨드 설치
brew install mongodb-community-shell

# mongoDB 실행
brew services restart mongodb/brew/mongodb-community

유저 생성

mongo

# mongodb 쉘 접속

use admin

db.createUser({ user: 'yt', pwd:'asdasd', roles:[]})
db.updateUser("yt", { roles: [ { role: "root", db: "admin" } ] })

암호 설정

vim /usr/local/etc/mongod.conf  # 또는 /etc/mongod.conf

해당 설정 추가

security:
  authorization: "enabled"

재시작

brew services restart mongodb/brew/mongodb-community