MySQL 匯出資料

2022-07-18 19:00:16 字數 585 閱讀 7671

以下例項中我們將資料表 runoob_tbl 資料匯出到 /tmp/runoob.txt 檔案中:

mysql> select * from runoob_tbl 

-> into outfile '/tmp/runoob.txt';

你可以通過命令選項來設定資料輸出的指定格式,以下例項為匯出 csv 格式:

mysql> select * from passwd into outfile '/tmp/runoob.txt'

-> fields terminated by ',' enclosed by '"'

-> lines terminated by '\r\n';

在下面的例子中,生成乙個檔案,各值用逗號隔開。這種格式可以被許多程式使用。

select a,b,a+b into outfile '/tmp/result.text'

fields terminated by ',' optionally enclosed by '"'

lines terminated by '\n'

from test_table;

mysql 匯出資料

方法一 select.into outfile mysql select from mytbl into outfile tmp mytbl.txt 檢視mytbl.txt中內容如下 mysql system cat tmp mytbl.txt1 name1 2 name2 3 n 匯出的檔案中資料...

MySQL資料匯出

方法一 select.into outfile mysql select from mytbl into outfile tmp mytbl.txt query ok,3 rows affected 0.00 sec 檢視mytbl.txt中內容如下 mysql system cat tmp myt...

MySql資料匯出

mysql use caida 選擇要操作的資料庫 mysql select ip,node,physical cpu,cpu cores,processor,cpumodel,throughtput,use processor,use memory,use disk from three open...