Pages

Jun 29, 2011

MySQL export to file

Export a query result to a file directly from MySQL.

First open mysql with "-s -t" arguments - this will force mysql to output without boxing characters:
mysql -s -t -u <user> <database_name>

Now:
SELECT * FROM table INTO OUTFILE '/path/to/file.txt'

It's all good, peace!

No comments:

Post a Comment