MySQL查詢結果匯出到Excel

2021-10-21 03:32:09 字數 666 閱讀 5823

mysql -uroot -p

use databa***xx;

select user, host, password from user into outfile '/tmp/data.xls';

select b.name,a.title,a.answer from plugin_faq_question a join plugin_faq_category b on a.category_id = b.id into outfile '/tmp/data.xls';

-- 執行上述命令會提示下面的錯誤

error 1290 (hy000): the mysql server is running with the --secure-file-priv option so it cannot execute this statement

-- 解決1,檢視下面這個變數指示的路徑,把檔案匯出到該路徑下即可

show variables like "secure_file_priv";

select user, host, password from mysql.user into outfile '/var/lib/mysql-files/data.xls';

缺點: 資料中存在html字元時會有格式問題

mysql查詢結果匯出到檔案

方法一 直接執行命令 mysql select count 1 fromtable into outfile tmp test.xls query ok,31 rows affected 0.00 sec 在目錄 tmp 下會產生檔案test.xls 遇到的問題 mysql select count...

mysql查詢結果匯出到檔案

環境 mysql 進入mysql shell mysql u username password password database database然後輸入匯出查詢結果命令 select from table1 into outfile data test1.txt 報錯error 1045 28...

DataTable匯出到word或excel

using system using system.data using system.configuration using system.collections using system.web using system.web.security using system.web.ui usin...