
# 通过Sqoop从Hive导出数据到MySQL 8.0时报数据格式错误
本章节仅适用于MRS 3.1.0版本集群。
#### 用户问题
MRS 3.1.0集群Sqoop从Hive导出数据到MySQL 8.0时报数据格式错误。
#### 问题现象
![](https://support.huaweicloud.com/trouble-mrs/zh-cn_image_0000001256218344.png "点击放大")
![](https://support.huaweicloud.com/trouble-mrs/zh-cn_image_0000001303858369.png "点击放大")
#### 原因分析
通过日志判断得知是格式异常。
#### 处理步骤
确认分隔符、表字段的格式无问题，在sqoop语句中添加--columns绑定对应字段。
**sqoop export --connect jdbc:mysql://** *数据库IP地址:端口号/数据库名* **--username** *数据库用户名* **--table** *表名* **--columns** *列字段（多个列用英文逗号分开）* **-export-dir** *导出地址* **--fields-terminated-by** *分隔符* **--input-null-string** **'\\\\N'** **--input-null-non-string '\\\\N' -m 1** **-P**
样例：
**sqoop export --connect jdbc:mysql://192.168.0.6:3306/test --username root** **--table hkatg_agr_prod_city_summ --columns year,city_name,city_code,prod_code,prod_name,prod_type,sown_area,area_unit,yield_wegt,yield_unit,total_wegt,total_wegt_unit,data_sorc_code,etl_time -export-dir hdfs://hacluster/user/hive/warehouse/dm_agr_prod_city_summ02 --fields-terminated-by ',' --input-null-string '\\\\N' --input-null-non-string '\\\\N' -m 1** **-P**
