How To Connect To A Remote Mongodb Server With Mongohub For Mac

How To Connect To A Remote Mongodb Server With Mongohub For Mac

A guide to show you how to install MongoDB on Mac OS X.

  1. MongoDB 2.2.3
  2. Mac OS X 10.8.2

1. Download MongoDB

Get MongoDB from official website, extracts it :

Mongod binary. 14 Jun 2011 MongoHub for Mac: Free Download - Native Mac GUI application for mongodb. Cd /usr/local/src curl -remote-name 2-latest. I had issues connecting to my cluster with Robomongo? 6; MongoDB Server 3.

2. MongoDB Data

By default, MongoDB write/store data into the /data/db folder, you need to create this folder manually and assign proper permission.

Note
Permissin is required to avoid following locking error :

3. Add mongodb/bin to $PATH

Create a ~/.bash_profile file and assign /usr/local/mongodb/bin to $PATH environment variable, so that you can access Mongo’s commands easily.

4. Start MongoDB

Start MongoDB with mongod and make a simple mongo connection with mongo.

Terminal 2
Note
If you don’t like the default /data/db folder, just specify an alternate path with --dbpath

5. Auto Start MongoDB

To auto start mongoDB, create a launchd job on Mac.

Puts following content :

Load above job.

Try restart your Mac, MongoDB will be started automatically.

Run this command sudo bless -mount / -firmware /Applications/Utilities/NAMEOFFIRMWAREINSTALLER.app/Contents/NAMEOFFIRMWARE.scapThis should restart your computer and flash the firmware. Reboot into Recovery Mode. Navigate to and open /System/Library/CoreServices/SystemVersion.plist. Apple efi firmware update 2.2 for mac windows 10. Type csrutil disable. Open Terminal under the Utilities menu.

References

About the Author

mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments



how can I connect to a remote mongo server from Mac OS terminal (2)

With Mongo 3.2 and higher just use your connection string as is:

I would like to drop into the mongo shell in the terminal on my MacBook. However, I'm interested in connecting to a Mongo instance that is running in the cloud (compose.io instance via Heroku addon). I have the name, password, host, port, and database name from the MongoDB URI:

I have installed mongodb on my MacBook using Homebrew not because I want Mongo running on my Mac, but just to get access to the mongo shell program in order to connect to this remote database.

However, I can't find the right command to get me the full shell access I would like. Using instructions found here http://docs.mongodb.org/manual/reference/program/mongo/ (search for 'remote') I am able to get what looks like a connection, but without giving my username or password I am not fully connected. Running db.auth(username, password) returns 1 (as opposed to 'auth fails' when I provide incorrect username and password), but I continue to get an 'unauthorized' error message when issuing the show dbs command.

You are probably connecting fine but don't have sufficient privileges to run show dbs .

You don't need to run the db.auth if you pass the auth in the command line: Gpg and outlook 2016 for mac.

How To Connect To A Remote Mongodb Server With Mongohub For Mac

Once you connect are you able to see collections?

If so all is well and you just don't have admin privileges to the database and can't run the show dbs

How To Connect To A Remote Mongodb Server With Mongohub For Mac
© 2020