카테고리 없음
[mongoDB] 설치, 실행, 종료 명령어
위시리
2025. 3. 14. 13:05
mac - terminal 에서 mongoDB 관련 명령어 정리
1. 설치
brew install mongodb-community
특정 버전을 설치하고 싶다면 (ex. 6.0 버전) 다음과 같이 입력하면 된다.
brew install mongodb-community@6.0
2. 실행
brew services start mongodb-community
brew services start mongodb-community@6.0
3. 포트 번호 확인
grep "port" /etc/mongod.conf
cat /usr/local/etc/mongod.conf | grep port
'port : ' 뒤에 포트 번호가 출력된다.
4. db 확인
show dbs
5. mongo shell 접속
mongosh
mongh shell에 접속하면 test> 모드가 실행된다.
5-1. mongo shell 종료
exit
6. mongo db 종료
brew services stop mongodb-community
brew services stop mongodb-community@6.0