Tech Junkie Blog - Real World Tutorials, Happy Coding!: MongoDB In-Depth: Setting Up And Starting MongoDB For The First Time

Thursday, September 5, 2019

MongoDB In-Depth: Setting Up And Starting MongoDB For The First Time

In the previous post we installed MongoDB on a Linux orperating system.  On this post we are going to setup the data folder that MongoDB needs and connect to MongoDB in the command line. 

Here are the steps:


  1.  Create a folder call /data/ then create another folder call db underneath it with the mkdir command, I've already created the folder so I can't do it on the command prompt again.
           But you basically run the following commands
               1.  mkdir /data
                2. mkdir /data/db

    2.  Now we want to start the MongoDB service with the command mongod --dbpath "/data/db"








    You only have to do this once, afterward you can just type mongod and the service should start.           You would need sudo rights to run these commands.

3. Now you can connect to you MongoDB instance with the mongo command







No comments:

Post a Comment

Search This Blog