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

Sunday, June 6, 2021

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


  1. Hi,
    Thanks for sharing this beautiful and informative article.
    I have really enjoyed reading the article and of course learned several new things from your content.
    I would definitely share this blog on my social media pages.
    Looking forward and waiting for your new blogs
    Thank you

  2. “Hey ,

    You did an excellent job on this post! I’d like to add an extra productivity tip to your list if you don’t mind?

    Have a great day,
    Samarth J

  3. Online PDF to Word converter free to convert documents online, Upload your file and transform it into Word in one click. Convert your Doc and Docx right now into Word and PDF format. Visit our Website!

  4. App Dev Zone providing you many leading services, one way For All Design, to meet the marketing needs and Development. Including Logo Design, SEO services (SEO booster), WordPress Website Design and Hosting in all over World. Visit our Website to learn more!

  5. I am very happy after visiting your website with very useful information. I am from one of the digital marketing institute... To visit my institute, click on link
    Visit Digital Guru


Search This Blog