Use the Sqoop tool to import records from MySQL database to HDFS, import records from MySQL database to Hive, and export data from HDFS to MySQL database
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| hive |
| mysql |
| sqoop01 |
| test |
+--------------------+
5 rows in set (0.00 sec)
2. Create a table
mysql> use sqoop01;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
create table t_user(id int, name varchar(20), age int);
insert into t_user values(1, 'David', 21)
insert into t_user values(2, 'Tom', 20)
insert into t_user values(3, 'Amy', 19)
mysql> select * from t_user;
+------+-------+------+
| id | name | age |
+------+-------+------+
| 1 | David | 21 |
| 2 | Tom | 20 |
| 3 | Amy | 19 |
+------+-------+------+
3 rows in set (0.02 sec)