我试图通过命令行将csv文件导入mysql,它已被导入为垃圾字符

时间:2014-12-26 06:11:36

标签: mysql

我试图将abc.csv文件导入到abc mysql table ..中导入垃圾字符。     请帮我me.iam坚持这个。     我想将.csv文件插入到具有给定列和文件的mysql中。     现在我只得到垃圾字符。我会帮助我。

          mysql> LOAD DATA LOCAL INFILE 'D:\abc.xls'
              ->   INTO TABLE abc
              ->   FIELDS TERMINATED BY ','
              ->   LINES TERMINATED BY '\n'(name,id);
          Query OK, 26 rows affected, 68 warnings (0.08 sec)
          Records: 32  Deleted: 0  Skipped: 6  Warnings: 68

          mysql> select * from abc;
          +------------+------+
          | name       | id   |
          +------------+------+
          |            |    0 |
          |      ¤     | NULL |
          |    ? ¤ ?   | NULL |
           ¶ ? |    0 |
          |      ?  ?? | NULL |
          |    ?   ?   | NULL |
          |            | NULL |
          |            | NULL |
          |   Check Ce | NULL |
          |  ?   ¤ ?   | NULL |
          |  ? ? ¤   ? | NULL |
          |  ?   ¤ ?   | NULL |
          |  ? ? ¤   " | NULL |
          |          | NULL |
          |  ¶ ?       |    0 |
          |  ¶ ?   ??? | NULL |
          |  ¶ ?   ¦¦¦ | NULL |
          |            |    0 |
          |  5 ?  Inpu | NULL |
          |  ; ?  Titl | NULL |
          |  < ?  Tota | NULL |
          |  C h e c k |    0 |
          |  L.    ? d | NULL |
          | ¶8     ? X |    0 |
          |            | NULL |
           ? ? ? |    0 |
          +------------+------+
          26 rows in set (0.00 sec)

          mysql> desc abc;
          +-------+-------------+------+-----+---------+-------+
          | Field | Type        | Null | Key | Default | Extra |
          +-------+-------------+------+-----+---------+-------+
          | name  | varchar(10) | NO   | PRI |         |       |
          | id    | int(10)     | YES  |     | NULL    |       |
          +-------+-------------+------+-----+---------+-------+
          2 rows in set (0.33 sec)

          mysql>

0 个答案:

没有答案