注意!如果重置了代码仓库请用以下步骤:
start-all.shschematool -dbType mysql -initSchema重置之后mysql数据库里数据没了,所以重新输入就行。mysql -uroot -p123123 -h127.0.0.1create database hdfsdb;use hdfsdb;create table student(stu_no int primary key, stu_name varchar(20), stu_age int);insert into student values(202001,"zhangsan",18);insert into student values(202002,"lisi",19);insert into student values(202003,"wangwu",20);exit;hivecreate table test2(stu_no int,stu_name string,stu_age int)row format delimitedfields terminated by ",";exit;sqoop import --connect jdbc:mysql://127.0.0.1:3306/hdfsdb --username root --password 123123 --query 'select stu_no, stu_name,stu_age from student where stu_age>=20 and $CONDITIONS' --target-dir /user/root/hdfsdb6 --fields-terminated-by ',' -m 1 hiveload data inpath '/user/root/hdfsdb6/part-m-00000' into table
下一篇:SQL创建新的输出字段