Friday, June 15, 2012

Save MySQL query results from console

I assume you have logged into your MySQL console. You can save your query result into a file like below:

Text File 

SELECT * FROM your_table .
INTO OUTFILE '/tmp/file.txt'


CSV File

SELECT * FROM your_table 
       INTO OUTFILE '/tmp/file.csv'
       FIELDS TERMINATED BY ','
       ENCLOSED BY '"'
       LINES TERMINATED BY '\n'




Reference : http://www.tech-recipes.com/rx/1475/save-mysql-query-results-into-a-text-or-csv-file/

4 comments:

  1. Hi, I desire to subscribe for this web site to obtain most up-to-date updates, so where can i do it please help.
    web design firm in tampa

    ReplyDelete
    Replies
    1. You may use this blog feed and get the recent updates.

      Delete
  2. Are you planning to spend your weekend or vacation in camping? Our store contains all necessary camping equipment. The quality of our products and our prices will delight you. Camping Supplies

    ReplyDelete
  3. Thanks for this valuable post Pro Website Development and Operations gives us the experience we need to create and operate a large scale production website. Each website has its own unique set of problems regarding its design problems that can get worse when agile methodologies are adopted for rapid results.

    ReplyDelete