1.下载sqoop
wget http://mirror.bit.edu.cn/apache/sqoop/1.4.7/sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz
2解压-安装
tar -zxvf sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz
3在/etc/profile下配置sqoop的环境变量
Vi /etc/profile
SQOOP_HOME=sqoop的安装路径(在此路径pwd就能看到全路径)
PATH=追加:$SQOOP_HOME/bin
3.1保存后使其生效
source /etc/profile
3.2开启mysql远程访问:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'XXX';
FLUSH PRIVILEGES;
4.连接数据库-需要将MySQL的驱动jar包拉到sqoop的lib下
测试连接-查看test数据库下所有表
sqoop list-tables -connect jdbc:mysql://192.168.203.72:3306/test --username root --password XXX