Skip to content

Convert a mysqldump file to JSON to import into Mongo DB

Notifications You must be signed in to change notification settings

neuledge/mysqldump_to_json

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Overview

This node.js script allows the conversion of a mysqldump file to JSON, which is useful for importing data into MongoDB. A mysqldump can generally be performed using this command:

mysqldump database_name_here -u root -p > output.sql

See this link for more info on mysqldump: http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

Once you have the dump.sql file, run this command to generate output.json:

node converter.js dump.sql

The converter will create a json file per table/collection. You can now import the json file to mongo via this command:

mongoimport --type json --jsonArray --db db_name_here --collection collection_name_here --file file_name_here.json

About

Convert a mysqldump file to JSON to import into Mongo DB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%