Search Marketing

   
   

MySQL Query Output to Text File

Fri May 02, 2008 9:55 pm
<<     >>
Comments: 4 Views: 4814

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
Name:
*
Comment:
*
Number:
Math (24 + 1)
* required
SubCategories
Books

© 2009 Christonium LLC

Christonium.com
|
Terms of Use
|
Privacy