今天使用sqoop1.4.5版本的(hadoop使用cdh5.4)因为乱码问题很是头痛半天。下面进行一一总结
命令:
[root@sdzn-cdh01 etc]# sqoop export --connect "jdbc:mysql://192.168.200.40:3306/otherdb?useUnicode=true&characterEncoding=utf-8" -m 1 --username root --password root --table use_02 --export-dir /sdzn_yhhx/user0/ --input-null-string "\\\\N" --input-null-non-string "\\\\N" --input-fields-terminated-by "," --input-lines-terminated-by "\\n"
一.连接数据库主机失败
异常表象:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
1.没有mysql-connect-jdbc.jar的驱动jar包
2.不能ping通访问的主机
二.访问权限问题
异常:
Error executing statement: java.sql.SQLException: Access denied for user 'root'@'