MySql : Publish results of a query to a text file « Intelligrape Groovy & Grails Blogs

MySql : Publish results of a query to a text file

Posted by

A while back I was trying to debug an error in our application logic. For that I had to analyze the results of a query

This analysis was getting pretty tough to do on the command line. So, I tried to find a way to transfer the results of a query to a text file so that they can be analysed easily.

With help from google, I got my answer at http://www.wellho.net/forum/The-MySQL-Relational-Database/MySQL-query-to-a-text-file.html

echo "<YOUR SELECT QUERY>"| /usr/local/mysql/bin/mysql --user=root --password=password dbName > /path/to/your/textFIle.txt/

Hope this helps

Tags:
This entry was posted on August 16th, 2010 at 9:29 am and is filed under Database . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply