Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Reports
    • Case Studies
    • Whitepapers
    • Blog
    • Testimonials
    • Community
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Career
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • My License
  • Download
search

Studio 3T Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

Import a SQL Database to MongoDB in 5 Steps

Posted on: 10/04/2019 (last updated: 09/03/2022) by Kathryn Vargas

In this tutorial, we’ll show you the quickest way to import an entire SQL database to MongoDB using Studio 3T and its new SQL Migration feature.

Want to watch instead? Skip to the video tutorials.

What you need

  1. Sign up for Studio 3T’s free 30-day trial to access SQL Migration.
  2. Get your SQL database connection details ready. We’ll use MySQL in this tutorial but SQL Server, PostgreSQL, and Oracle are also supported.

To illustrate a simple SQL database import, we’ll use the publicly available world database (download it here) which contains three tables:

  • city
  • country
  • countrylanguage

We’ll import each SQL table to a MongoDB collection, which means we should have three new collections in our target database.

1 – Open SQL Migration

Click on SQL Migration > SQL to MongoDB Migration in the toolbar.

SQL to MongoDB Migration

2 – Choose the source SQL connection

Click on Click here to connect to a server to open SQL Connection Manager.

Open a saved connection

If you’ve already saved a connection, choose your source SQL connection from the list.

Open SQL Connection Manager

Create a new connection

To create a new SQL connection, click on New Connection, enter the connection details under the Server and SSH tabs, and click Save.

new connection

3 – Choose your target MongoDB connection

Like Step 2, click on Click here to connect to a server to choose an existing MongoDB connection or to create a new one.

Here we’ll choose S3T as our target connection. This is where the three collections will be created.

S3T connection

4 – Choose SQL source tables

Studio 3T calls them “import units”, but an import unit simply means the SQL source table.

Click on Add import units.

We’ll choose the three world tables – city, country, and countrylanguage – to create a collection for each. By default, Studio 3T will map each table to a collection with the same name.

Click OK. All three tables should appear in the Overview.

All SQL source tables should then appear in the Overview tab

5 – Run the SQL import

It’s time to run the SQL import. Click on Run Migration.

Click on Run Migration in the toolbar

Track your import in the Operations window on the bottom-left hand side.

Track operations and double-check the MongoDB collections

Double-check that the world database was imported in the Connection Tree (top-left).

And finally, double-click on a collection (like country, highlighted above) to check if the data looks correct (and it does!)

Next steps

The world database is quite simple – requiring no one-to-one or one-to-many table relationships – so the default mappings are sufficient for this import.

Note, however, that SQL Migration lets you fully control these mappings. Read our tutorial on how to merge multiple SQL tables into one MongoDB collection to find out how you can use SQL Migration to do more complex imports.

Explore the full SQL to MongoDB Migration documentation here, or check out the Import Wizard to discover more import options in Studio 3T.

Video tutorial


How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Kathryn Vargas

When she's not writing about working with MongoDB, Kathryn spends her free time exploring Berlin's food scene, playing the drums, learning languages (current mission: German), and hiking.

Article navigation

Related articles

  • MongoDB Monitoring, Auditing & Authentication: 3 Steps to Secure Your Database
  • MongoDB DevOps Checklist: 3 Steps to Secure Your Database
  • Export MongoDB to SQL in 5 Steps
  • What’s New in Studio 3T 2022.1 – SQL Connection Import/Export, MongoDB-AWS authentication
  • MongoDB, A Database with Porpoise – When You Have a Whale of a Performance Problem

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • Case Studies
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2022 3T Software Labs GmbH. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum
When you click "Accept", you are agreeing to cookies being on your device. They may improve site navigation, site usage analysis, or the relevance of messages. It is up to you which cookies are enabled. Read our Privacy Policy.
Manage cookies
Accept
✕

Privacy Preference Center

A cookie is a small file of letters and numbers that is downloaded on to your computer when you visit a website. Cookies are used by many websites and can do a number of things, eg remembering your preferences, recording what you have put in your shopping basket, and counting the number of people looking at a website. In the form below you can choose which cookies, except for essential cookies, to allow or disable.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected