MongoDB Connection Issues on macOS Catalina – Unable to Connect

mac-osxmongodb

After migrating my old MacBook Pro to a new machine via the Migration Assistant, I am unable to connect to MongoDB.

I re-installed it via Homebrew, and when I run:

brew services start mongodb-community

Terminal states that the service started, however, when I run: mongo

I get this error:

MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
2020-04-09T09:20:02.419-0400 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-04-09T09:20:02.419-0400 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13

I was following this guide on Medium: https://medium.com/better-programming/installing-mongodb-on-macos-catalina-aab1cbe0c836

to re-install MongoDB. Can anyone help me out?

Best Answer

Did you reinstall brew after migration? I had lots of problems after upgrade to Catalina. However on fresh Catalina (and brew default installation) I:

  1. brew tap mongodb/brew
  2. brew install mongodb-community
  3. brew services start mongodb-community
  4. ==> Successfully startedmongodb-community`

You can try to:

  1. download Xcode command line
  2. restart
  3. clear cellar folder and brew cache
  4. brew tap mongodb/brew

or full brew reinstall and follow 1-4.

Related Topic