首页 > 代码库 > mysql导出数据至指定文件的命令

mysql导出数据至指定文件的命令

根据查询语句,导出数据至指定文件
SELECT name INTO OUTFILE ‘/tmp/result.txt‘ FIELDS TERMINATED BY ‘-|-‘ OPTIONALLY ENCLOSED BY ‘"‘ LINES TERMINATED BY ‘\n‘ FROM table_name;

FIELDS TERMINATED BY 表示指定字段分隔符
OPTIONALLY ENCLOSED BY 表示指定字段包围符号
LINES TERMINATED BY 表示指定行与行分隔符