cd /export/servers/sqoop-1.4.6-cdh5.14.0/conf vim sqoop-env.sh
#Set path to where bin/hadoop is available export HADOOP_COMMON_HOME=/export/servers/hadoop-2.6.0-cdh5.14.0#Set path to where hadoop-*-core.jar is available export HADOOP_MAPRED_HOME=/export/servers/hadoop-2.6.0-cdh5.14.0#set the path to where bin/hbase is available export HBASE_HOME=/export/servers/hbase-1.2.0-cdh5.14.0#Set the path to where bin/hive is available export HIVE_HOME=/export/servers/hive-1.1.0-cdh5.14.0
第二步:在mysql当中创建数据库以及数据库表并插入数据
创建数据库表
CREATEDATABASEIFNOTEXISTS library; USE library; CREATETABLE book( id INT(4)PRIMARYKEYNOTNULLAUTO_INCREMENT, NAME VARCHAR(255)NOTNULL, price VARCHAR(255)NOTNULL);
插入数据
INSERTINTO book(NAME, price)VALUES('Lie Sporting','30'); INSERTINTO book (NAME, price)VALUES('Pride & Prejudice','70'); INSERTINTO book (NAME, price)VALUES('Fall of Giants','50');