Mysql-uroot-p into the database and create a database Hangzhou. Use Hangzhou;
CREATE TABLE t1 (id int (1), name varchar (x), age char (1), Job varchar (20));
To create a file under root 1.txt content is as follows, directly separated by tab:
[Email protected]_168_2_193 ~]# VI 1.txt
1 LX It
4. Then enter the database to execute load data local infile '/root/1.txt ' into table T1;
5. View the results:
Mysql> Show tables;
+--------------------+
| Tables_in_hangzhou |
+--------------------+
| T1 |
+--------------------+
1 row in Set (0.00 sec)
mysql> Load Data local infile '/root/1.txt ' into table T1;
Query OK, 1 row affected, 1 Warning (0.00 sec)
Records:1 deleted:0 skipped:0 warnings:1
Mysql> select * from T1;
+------+------+------+------+
| ID | name | Age | Job |
+------+------+------+------+
| 1 | LX | 2 | it |
+------+------+------+------+
1 row in Set (0.00 sec)
This article is from the "Fluffy Duck" blog, please be sure to keep this source http://woshitieren.blog.51cto.com/2466034/1671684
How MySQL inserts multiple rows of data