将csv文件数据导入mysql表获取垃圾值

时间:2017-05-01 12:06:52

标签: mysql csv phpmyadmin

我想将cgv文件(pincode.csv)中的5 gb记录导入到特定列(密码,城市和州)的mysql表中。

以下是我的csv文件

[2017-05-01 18:51:53,219] TRACE Explainer: Planning 'aj_dev' di = 1
239099 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  - Planning 'aj_dev' di = 1
[2017-05-01 18:51:53,220] TRACE Explainer:   Original filter: di = 1
239100 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -   Original filter: di = 1
[2017-05-01 18:51:53,220] TRACE Explainer:   Hints: density[false] bin[false] stats[false] map-aggregate[false] sampling[none]
239100 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -   Hints: density[false] bin[false] stats[false] map-aggregate[false] sampling[none]
[2017-05-01 18:51:53,221] TRACE Explainer:   Sort: none
239101 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -   Sort: none
[2017-05-01 18:51:53,221] TRACE Explainer:   Transforms: None
239101 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -   Transforms: None
[2017-05-01 18:51:53,221] TRACE Explainer:   Strategy selection:
239101 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -   Strategy selection:
[2017-05-01 18:51:53,226] TRACE Explainer:     Query processing took 3ms and produced 1 options
239106 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -     Query processing took 3ms and produced 1 options
[2017-05-01 18:51:53,226] TRACE Explainer:     Filter plan: FilterPlan[AttributeIndex[di = 1][None]]
239106 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -     Filter plan: FilterPlan[AttributeIndex[di = 1][None]]
[2017-05-01 18:51:53,226] TRACE Explainer:     Strategy selection took 0ms for 1 options
239106 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -     Strategy selection took 0ms for 1 options
[2017-05-01 18:51:53,226] TRACE Explainer:   Strategy 1 of 1: AttributeIndex
239106 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -   Strategy 1 of 1: AttributeIndex
[2017-05-01 18:51:53,226] TRACE Explainer:     Strategy filter: AttributeIndex[di = 1][None]
239106 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -     Strategy filter: AttributeIndex[di = 1][None]
[2017-05-01 18:51:53,227] TRACE Explainer:     Plan: org.locationtech.geomesa.accumulo.index.EmptyPlan
239107 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -     Plan: org.locationtech.geomesa.accumulo.index.EmptyPlan
[2017-05-01 18:51:53,227] TRACE Explainer:       Table: 
239107 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -       Table: 
[2017-05-01 18:51:53,227] TRACE Explainer:       Deduplicate: false
239107 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -       Deduplicate: false
[2017-05-01 18:51:53,227] TRACE Explainer:       Column Families: all
239107 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -       Column Families: all
[2017-05-01 18:51:53,228] TRACE Explainer:       Ranges (0): 
239108 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -       Ranges (0): 
[2017-05-01 18:51:53,228] TRACE Explainer:       Iterators (0):
239108 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -       Iterators (0):
[2017-05-01 18:51:53,228] TRACE Explainer:     Plan creation took 1ms
239108 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -     Plan creation took 1ms
[2017-05-01 18:51:53,228] TRACE Explainer:   Query planning took 17ms
239108 [Thread-5] TRACE org.locationtech.geomesa.index.utils.Explainer  -   Query planning took 17ms

和表结构是

504293,Asifabad,ANDHRA PRADESH
504231,Luxettipet,ANDHRA PRADESH
504201,Chennur,ANDHRA PRADESH
504295,Asifabad,ANDHRA PRADESH

我尝试了下面给出的代码

+---------+--------------+------+-----+---------+----------------+
| Field   | Type         | Null | Key | Default | Extra          |
+---------+--------------+------+-----+---------+----------------+
| id      | int(10)      | NO   | PRI | NULL    | auto_increment |
| pincode | int(10)      | NO   | UNI | NULL    |                |
| city    | varchar(200) | YES  |     | NULL    |                |
| state   | varchar(200) | YES  |     | NULL    |                |
+---------+--------------+------+-----+---------+----------------+

运行此命令后,它只导入2个字段,这是一些垃圾值。

0 个答案:

没有答案