: http://img19.imageshack.us/img19/7336/82051321.png http://img27.imageshack.us/img27/2935/24285862.png
" ". LOAD DATA INFILE (\ r\n), mysql, , - unix (\n).
, , :
mysql> load data infile 'data.txt' into table testDel (val);
Query OK, 6 rows affected (0.01 sec)
Records: 6 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from testDel;
+----+----------------+
| id | val |
+----+----------------+
| 7 | hello world 1
| 8 | hello world 2
| 9 | hello world 3
| 0 | hello world 4
| 1 | hello world 5
| 12 | hello world 6 |
+----+----------------+
6 rows in set (0.00 sec)
mysql> select id, hex(val) from testDel;
+----+------------------------------+
| id | hex(val) |
+----+------------------------------+
| 7 | 68656C6C6F20776F726C6420310D |
| 8 | 68656C6C6F20776F726C6420320D |
| 9 | 68656C6C6F20776F726C6420330D |
| 10 | 68656C6C6F20776F726C6420340D |
| 11 | 68656C6C6F20776F726C6420350D |
| 12 | 68656C6C6F20776F726C642036 |
+----+------------------------------+
6 rows in set (0.01 sec)
, , - clobbering . , "" ? , - , hex (val), "" .
, :
mysql> load data infile 'data.txt' into table testDel lines terminated by '\r\n' (val);
Query OK, 6 rows affected (0.00 sec)
Records: 6 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from testDel;
+----+---------------+
| id | val |
+----+---------------+
| 13 | hello world 1 |
| 14 | hello world 2 |
| 15 | hello world 3 |
| 16 | hello world 4 |
| 17 | hello world 5 |
| 18 | hello world 6 |
+----+---------------+
6 rows in set (0.00 sec)