Moving table from MySql into Local File System


#1

Hello,

I am practicing questions on the itversity Lab.

On investigating tables on MySql in database retail_db, I get:

mysql> show tables;
±--------------------+
| Tables_in_retail_db |
±--------------------+
| categories |
| customers |
| departments |
| order_items |
| order_items_nopk |
| orders |
| products |
±--------------------+
7 rows in set (0.00 sec)

When I investigate tables available on local file system on lab, I receive the following:

[patrickorourke160893@gw02 ~]$ ls /data/retail_db
categories customers departments order_items orders products

I know how to move tables and files from local file system into hdfs. However, is it possible to move tables from MySql into Local file system like into /data/retail_db?

Many thanks,
Patrick


#2

@PatrickO_Rourke,

Use Sqoop export to copy tables from MySQL to HDFS. After exporting, use hadoop command hdfs -dfs copyToLocal or hdfs -dfs put to copy the data from hdfs to local.


#3

Thanks Sravan, really appreciate it!