Search Marketing

   
   

MySQL Query Output to Text File

Mon Nov 30, 2009 1:50 am
<<     >>
Comments: 6 Views: 11255

Using MySQL to output the query directly to a text file is easy using the following command.

mysql > select * from table INTO OUTFILE '/tmp/test.txt';

This is a useful feature if you have a query that will take a longtime or the results will overwhelm a small screen.

Note: this command is not like a database backup or MySQL Dump.



Comments
Mon Aug 03, 2009 12:32 pm
Name: chara | Comment: thank you!, i was looking for this

Fri Nov 06, 2009 4:13 am
Name: lauta | Comment: hey I have a remote server with my database, can I use this command to output a file to my local machine?

Fri Nov 06, 2009 11:58 am
Name: sql | Comment: you could always output it on the remote machine and scp it to your local one

Fri Nov 06, 2009 8:05 pmhere is an article we wrote about this issue:
INTO OUTFILE with Remote Machine

Mon Nov 30, 2009 1:41 am
Name: shekh | Comment: thank you. how to delete the outfile i.e. test.txt?



Mon Nov 30, 2009 1:50 am
Name: mysql | Comment: first exit mysql, and then at the shell prompt enter the following to delete the file
rm /tmp/test.txt


Name:
*
URL: http: (ex. cnn.com)
Comment:
*
Number:
Math (24 + 5)
* required
SubCategories
Books

© 2017 Christonium LLC

Christonium.com
|
Terms of Use
|
Privacy
ccc