[mac OS] mongoDB설치방법 & 설치 안될때
homeBrew를 이용해서 간편하게 설치 가능
터미널 열고, 아래 명령어 차례로 입력만 하면 끝
$brew tap mongodb/brew
$brew install mongodb-community
$brew services start mongodb-community
참고는 아래사이트!
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/
Install MongoDB Community Edition on macOS — MongoDB Manual
Docs Home → MongoDB Manual MongoDB AtlasMongoDB Atlas is a hosted MongoDB service option in the cloud which requires no installation overhead and offers a free tier to get started.Use this tutorial to install MongoDB 6.0 Community Edition on macOS using
www.mongodb.com
나의 설치환경 : mac OS
위 메뉴얼대로 척척 되면 너무나 좋았겠으나
나의 mac은 service start하면 install안됬는데? 라고 했다.
brew update도 되어있는 상태인데 대체 왜 설치가 안된단 말인가...ㅠㅠ
나의 경우에는 brew tap 하기 전에 아래 명령어를 실행하고서야 설치가 되었다.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
위 명령어 입력 한후에 아래 명령어 차근차근 입력
$ brew tap mongodb/brew
$ brew install mongodb-community@4.4 //버전은 mongodb사이트 가서 최신버전 보기
$ brew services start mongodb-community@4.4 // 시작하기 했을 때 Successfully started되면 성공
$ brew services stop mongodb-community@4.4 //멈추기
만약 실행이 이미 되었는데 뭐가 안되면 아래꺼도 시도해보기...
brew services stop mongodb
brew uninstall mongodb
brew tap mongodb/brew
sudo chown -R 'id' /usr/local/var/log
brew install gcc
brew install mongodb-community
brew services start mongodb-community
그런데 설치 안하고 서버랑 연결할수있으니 ... 그 방법을 추천
mongodb.com에서 로그인하고 database랑 접근 키랑 만들고나서
connect하는 코드를 서버에 적고
프로젝트에서 "npm install mongodb@버전몇" 설치해서 연동하면 됨