8

I want to export select * from table results to a text file from the command line in linux. How should I do this?

Thanks, Jean

1 Answer 1

18

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'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.