Export Data From MongoDB to Mysql Via Csv
Monday, September 21, 2015
How To Export Data From MongoDB to Mysql Via Csv :-
There is no direct way to export MongoDB to Mysql i couldn't find any direct way but here is steps to export data from MongoDB To Mysql.
Step 1:- Export mongo to csv
>mongoexport --db --collection --csv --fields [,,] --out .csv
Step 2:- Create the mysql database skeleton
mysql> CREATE TABLE ( VARCHAR(512)[, VARCHAR(512),...]);
Step 3:- Import Csv to mysql
>mysqlimport -u -p --local --fields-optionally-enclosed-by='"' --fields-terminated-by=',' --lines-terminated-by='\n' --ignore-lines=1 desired_mysql_table_name.csv
There is no direct way to export MongoDB to Mysql i couldn't find any direct way but here is steps to export data from MongoDB To Mysql.
Step 1:- Export mongo to csv
>mongoexport --db
Step 2:- Create the mysql database skeleton
mysql> CREATE TABLE
Step 3:- Import Csv to mysql
>mysqlimport -u
0 comments:
Post a Comment