mysql插入多行資料的方法

來源:互聯網
上載者:User

標籤:mysql

  1. mysql -uroot -p進入資料庫隨便建立一個資料庫create database hangzhou; use hangzhou;

  2. 建立個表create table t1 (id int(1),name varchar(20),age char(1),job varchar(20));

  3. 在root下建立個檔案1.txt 內容如下,直接用tab隔開:

[[email protected]_168_2_193 ~]# vi 1.txt

1       lx      20      it

4.然後進入資料庫執行load data local infile ‘/root/1.txt‘ into table t1;

5.查看結果:

 

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)



 

本文出自 “毛毛鴨” 部落格,請務必保留此出處http://woshitieren.blog.51cto.com/2466034/1671684

mysql插入多行資料的方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.