开发者

How to Export SQL Query to TXT Using Command Line

开发者 https://www.devze.com 2023-01-26 01:34 出处:网络
I want to expor开发者_高级运维t select * from table results to a text file from the command line in linux. How should I do this?

I want to expor开发者_高级运维t select * from table results to a text file from the command line in linux. How should I do this?

Thanks, Jean


look at link

you only need to add this to the query

select * from table INTO OUTFILE '/tmp/myfilename.txt'

you can improve this to csv file (using it in excel latter)

like :

INTO OUTFILE '/tmp/myfilename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
0

精彩评论

暂无评论...
验证码 换一张
取 消