>From: LAMP [mailto:lamp@stripped]
>Sent: Sunday, January 09, 2011 9:46 PM
>Subject: Re: export result from select statement
>maybe it's "clear" to other but it's pretty unclear.
>#mysql -username -p "select * from table_name where id=123" >
>actually doesn't work?!?
[JS] The command you wrote doesn't redirect the input of the client. It should
#mysql -username -pxxx dbname < /home/me/testing/text.sql >
By the way, it is a bad idea to use "test" as a file or directory name. It is
very easy to accidentally invoke the "test" command, which can really make you
scratch your head.
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
Web site: www.the-infoshop.com
>Jerry Schwartz wrote:
>> The technique I've settled on is this:
>> mysql blah blah blah < the_select_query.sql > the_output_i_want.txt
>> That gives you a tab-delimited text file with column headings.
>> Jerry Schwartz
>> Global Information Incorporated
>> 195 Farmington Ave.
>> Farmington, CT 06032
>> 860.674.8796 / FAX: 860.674.8341
>> E-mail: jerry@stripped
>> Web site: www.the-infoshop.com
>>> -----Original Message-----
>>> From: LAMP [mailto:lamp@stripped]
>>> Sent: Saturday, January 08, 2011 6:05 PM
>>> To: mysql@stripped
>>> Subject: export result from select statement
>>> Hi guys,
>>> I wonder how to store to csv or txt file result from SELECT query?
>>> not a whole table nor database. Just results from SELECT query.
>>> Usually I use MySQL Query Browser and Export feature, but in this
>>> case I don't have access with MySQL Query Browser. Though, I have a
>>> command line access.
>>> I found on one place something like
>>> #SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
>>> Though, it doesn't work?!?
>>> MySQL General Mailing List
>>> For list archives: http://lists.mysql.com/mysql
>>> To unsubscribe: http://lists.mysql.com/mysql?unsub=1