Description:
The table have empty before running the command. The output have one extra rows of data which is the 'ID" field value 32. By the way... not sure how to specified ' ' as a field separator along with , as well. Hence, imported value on below have 'value' . Thank YOu
the input file is "City.txt":
1,'Kabul','AFG','Kabol',1780000;
2,'Qandahar','AFG','Qandahar',237500;
========
mysql> desc City;
+-------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+----------+------+-----+---------+----------------+
| ID | int(11) | | PRI | NULL | auto_increment |
| Name | char(35) | | | | |
| CountryCode | char(3) | | | | |
| District | char(20) | | | | |
| Population | int(11) | | | 0 | |
+-------------+----------+------+-----+---------+----------------+
5 rows in set (0.00 sec)
./mysqlimport --lines-terminated-by=";" --fields-terminated-by="," world2 /home/test/mysql-test/City.txt
mysql> select * from City;
+----+------------+-------------+------------+------------+
| ID | Name | CountryCode | District | Population |
+----+------------+-------------+------------+------------+
| 1 | 'Kabul' | 'AF | 'Kabol' | 1780000 |
| 2 | 'Qandahar' | 'AF | 'Qandahar' | 237500 |
| 32 | | | | 0 |
+----+------------+-------------+------------+------------+
3 rows in set (0.00 sec)
How to repeat:
1. Empty the table "City".(see the table structure on above)
2. Prepaid the "City.txt":
1,'Kabul','AFG','Kabol',1780000;
2,'Qandahar','AFG','Qandahar',237500;
====
3. At shell promt> ./mysqlimport --lines-terminated-by=";" --fields-terminated-by="," world2 /home/test/mysql-test/City.txt