Mysql表属性:
+---------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+---------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
| id | int(11) | NULL | YES | | NULL | | select,insert,update,references | |
| content| varchar(100) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
| time | varchar(100) | utf8_general_ci | YES | | NULL | | select,insert,update,references | |
+---------+--------------+-----------------+------+-----+---------+-------+---------------------------------+---------+
Mysql表数据:
mysql> select * from t1;
+------+-----------------------+---------------------+
| id | content | time |
+------+-----------------------+---------------------+
| 0 | 中华人民共和国 | 2015-01-09 06:00:00 |
| 1 | 中华人民共和国 | 2015-01-09 06:00:00 |
| 2 | 中华人民共和国 | 2015-01-09 06:00:00 |
| 3 | 中华人民共和国 | 2015-01-09 06:00:00 |
| 4 | 中国 | 2015-01-09 06:00:00 |
+------+-----------------------+---------------------+
数据获取执行命令:
[xiaoming@m103 ~]$ sqoop import --connect "jdbc:mysql://m103/test?useUnicode=true&characterEncoding=utf-8" --table t1 --username hive --password 111111 -m 1 --hive-import
从hive中查看导入的数据:
hive> select * from t1;
OK
0 ä¸-åŽäoo民共和国 2015-01-09 06:00:00
1 ä¸-åŽäoo民共和国 2015-01-09 06:00:00
2 ä¸-åŽäoo民共和国 2015-01-09 06:00:00
3 ä¸-åŽäoo民共和国 2015-01-09 06:00:00
4 ä¸-国 2015-01-09 06:00:00
Time taken: 21.283 seconds, Fetched: 5 row(s)
|