第一种情况数据文件 ttt.txt utf8编码
1 zhangzhibin 23
2 lisi 22
3 wangwu 21
mysql> select * from user;
+------+-------------+------+
| id | name | age |
+------+-------------+------+
| 0 | zhangzhibin | 23 |
| 2 | lisi | 0 |
| 3 | wangwu | 0 |
+------+-------------+------+
警告:
mysql> show warnings \G
*************************** 1. row ***************************
Level: Warning
Code: 1366
Message: Incorrect integer value: '?1' for column 'id' at row 1
注意:txt文件要转换成utf-8 无bom的编码格式;
文本文件中第一行zhangzhibin和23之间只有一个tab键
因此lisi和22以及wangwu和21之间只能像第一行那样只有一个tab键
修改多余tab键后:
mysql> select * from user;
+------+-------------+------+
| id | name | age |
+------+-------------+------+
| 0 | zhangzhibin | 23 |
| 2 | lisi | 0 |
| 3 | wangwu | 0 |
| 0 | zhangzhibin | 23 |
| 2 | lisi | 22 |
| 3 | wangwu | 21 |
+------+-------------+------+
修改编码格式以后(最后三行)
mysql> select * from user;
+------+-------------+------+
| id | name | age |
+------+-------------+------+
| 0 | zhangzhibin | 23 |
| 2 | lisi | 0 |
| 3 | wangwu | 0 |
| 0 | zhangzhibin | 23 |
| 2 | lisi | 22 |
| 3 | wangwu | 21 |
| 1 | zhangzhibin | 23 |
| 2 | lisi | 22 |
| 3 | wangwu | 21 |
+------+-------------+------+