List:General Discussion« Previous MessageNext Message »
From:hsv Date:July 26 2012 4:05am
Subject:Re: Exporting to CSV. Error Code: 2013. Lost connection to
MySQL server during query
View as plain text  
>>>> 2012/07/26 06:52 +0530, Dhaval Jaiswal >>>>
SELECT * FROM test INTO OUTFILE '/home/test.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n'

as above give your join condition before INTO OUTFILE.
<<<<<<<<
Right: MySQL server writes into some directory where it is, not where MySQL client is. If
less than a full path name is given, almost certainly the server will attempt to write
into a directory to which it has no permission, and almost certainly also not into one
that you want it to write into. If server and client run on separate machines with
separate disks, there is no means through OUTFILE of there setting the output where the
client is, only through client s standard output, where you get no choice of field
separator, line separator, or field-quote character (there is none), although you can
keep or skip the column names (-N for skipping them), and suppress the one-character
escape character (-r), same as FIELDS ESCAPED BY ''. There is no means of skipping "NULL"
or "\N" for nulls, which is not CSV format.

And if your MySQL is under Windows, be sure to read all instructions about entering full
pathnames. It is best to avoid the backslash (\), because that is a C-escape introduced
(along with much other C-stuff) into SQL s original PL1.

Thread
Exporting to CSV. Error Code: 2013. Lost connection to MySQL serverduring queryFred G25 Jul
  • Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQLserver during queryDhaval Jaiswal26 Jul
    • Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQLserver during queryFred G26 Jul
      • Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQLserver during queryMichael Widenius31 Jul
        • Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQLserver during queryFred G1 Aug
    • Re: Exporting to CSV. Error Code: 2013. Lost connection toMySQL server during queryhsv26 Jul
      • Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQLserver during queryFred G26 Jul