mysql數據導入到hive表中

在Hive中創建xd_phy_course數據表,其數據表結構如下表所示。使用Sqoop工具將MySQL中xiandian數據庫下xd_phy_course表導入到Hive數據倉庫中的xd_phy_course表中。在這裏插入圖片描述

1,先創建一個hive表,

create table h2 (stname string,stID int,class string,opt_cour string) row format delimited fields terminated by '\t' lines terminated by '\n';

2,用sqoop工具將mysql中的數據轉移到hive表中,這裏創建mysql表在mysql表

sqoop import --connect jdbc:mysql://localhost:3306/xiandian --username root --password bigdata --table m1 --hive-import --hive-overwrite --hive-table h2 -m 1 --fields-terminated-by '\t' --lines-terminated-by '\n'

參考教程

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章