This article is a mirror article of machine translation, please click here to jump to the original article.

View: 16650|Reply: 0

[Source] MySQL imports data into the MongoDB database

[Copy link]
Posted on 8/20/2017 5:22:14 PM | | | |
First, the syntax is as follows:

Export the required data from SQL in CSV format

Import data in csv format to a MongoDB database

Note: I have two "-" signs in front of type, and using one "-" will give an error


First, I have a table of vehicle location information in my database

There are more than 10 million data, and the export command is as follows:

The data is exported to the root directory of the C drive by default, as shown in the figure below:



Let's import the exported csv data into the MongoDB database with the following command:
No, you don'tCreate a database and collection first, and the program will automatically create it for us)



After execution, the import will begin, and the import progress bar will be displayed, as follows:

Parameter description:
-h: Indicates the IP of the database host
-u: Indicates the username of the database
-p: Indicates the password of the database
-d: Indicates the name of the database
-c: Indicates the name of the collection
-f: Indicates which columns to import





After waiting for about 5 minutes, the import was successful!!




The data is as follows, you can view the imported data, but the column names do not follow the column names we specified, I don't know why...






Previous:MongoDB v2.4 configuration file parameters
Next:.net/c# to get the machine code unique identifier
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com