'After installing MongoDB with Homebrew on MacOS (Intel Processor), Mongo throws the Error
Check xcode is installed
~ % xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Update tap
~ % brew tap mongodb/brew
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
opendht
==> Updated Formulae
Updated 20 formulae.
==> Updated Casks
Updated 18 casks.
Install mongodb-community 5.0
~ % brew install [email protected]
...
Check localisation
~ % brew --prefix
/usr/local
Start Mongodb
~ % brew services restart [email protected]
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
Go to Mongo and THERE IS THE ERROR
~ % mongo
MongoDB shell version v5.0.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:372:17
@(connect):2:6
exception: connect failed
exiting with code 1
Here also
~ % mongosh
Current Mongosh Log ID: 62270cdee016a9d630e71ef8
Connecting to: mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.2.2
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
Who can help?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
