Quick-Start Guide to mLab

Step 1: Set up a mLab account

To get started with mLab, you must first create your free mLab account. When that’s complete, you can add as many database subscriptions as you want.

For additional information about managing your mLab account users, contacts, and billing, see mLab Account Setup.

Step 2: Create a database subscription

After you’ve created your account, add a new database subscription. Get started quickly at no cost with a free Sandbox database.


For detailed steps to add a subscription, see Database Subscriptions. For a discussion on how to choose the right plan, see Plans and Data Centers.

Step 3: Connect to your new database

In a terminal window, connect to your database using the mongo shell (the command will look similar to the following example):

% mongo ds012345.mlab.com:56789/dbname -u dbuser -p dbpassword

You can grab your connection info after logging into your account and navigating to the database’s home page:


To view detailed connection instructions, troubleshooting tips, and alternate connection methods, see Connecting.

Step 4: Load some data

Here’s a quick exercise that tests an insertion into your new database:

  1. Assuming you successfully connected using the mongo shell in the previous step, run the following command:

     > db.mynewcollection.insert({ "foo" : "bar" })
  2. Next, run the command in the first line below and confirm that the shell output matches the second line (your “_id” value will be different):

     > db.mynewcollection.find()
     { "_id" : ObjectId("526705b4a3559a176784b4af"), "foo" : "bar" }

For additional instructions on how to get data, including larger datasets, into your mLab database, see Migrating Data into mLab.

Everything else you need to know

Congratulations - you’ve successfully created a mLab database! You’re now on your way to discovering more about mLab’s services so be sure to read through our documentation to get the most out of mLab and your MongoDB deployment(s). We have a broad range of topics that covers all the information you need to know about working with your mLab-managed database(s).

Our Support page also links to some great MongoDB resources that you’ll find super helpful.

Contact us

When in doubt, when you can’t find specific information, or when you’re just plain stuck, please don’t hesitate to email us directly at support@mlab.com.