溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

怎么在mysql表中進行導入

發(fā)布時間:2021-05-31 14:14:21 來源:億速云 閱讀:118 作者:小新 欄目:編程語言

這篇文章主要介紹怎么在mysql表中進行導入,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

1、說明

導入有兩種不同的方法,分別是load data infile...和mysqlimport,它們的本質是一樣的,區(qū)別只是在于一個在 MySQL 內(nèi)部執(zhí)行,另一個在 MySQL 外部執(zhí)行。

2、使用“l(fā)oad data infile...”命令,具體語法如下

mysql> load data [local]infile 'filename' into table tablename [option]

實例

// 清空表 test  
MySQL [t2]> truncate table test;
Query OK, 0 rows affected (0.07 sec)
 
MySQL [t2]> load data infile '/data/mysql/outfile.txt' into table test fields terminated by ',' enclosed by '"';
Query OK, 4 rows affected (0.10 sec)
Records: 4  Deleted: 0  Skipped: 0  Warnings: 0
 
 
MySQL [t2]> select * from test;
+------+------+------------+
| id   | name | content    |
+------+------+------------+
|    1 | a    | helloworld |
|    2 | b    | helloworld |
|    3 | c    | helloworld |
|    4 | d    | helloworld |
+------+------+------------+
4 rows in set (0.00 sec)

3、使用 mysqldump 實現(xiàn)

語法:

shell> mysqlimport -uroot -p [--local] dbname order_tab.txt [option]

以上是“怎么在mysql表中進行導入”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關知識,歡迎關注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI