List:General Discussion« Previous MessageNext Message »
From:Dhaval Jaiswal Date:July 26 2012 1:22am
Subject:Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQL
server during query
View as plain text  
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.


On Thu, Jul 26, 2012 at 1:32 AM, Fred G <bayespokerguy@stripped> wrote:

> Hi--
>
> I'm trying to do the following:
> SELECT db.emp.emp_fname, db.emp.emp_fname, db.sale.sale_date,
> db.sale.sale_no, db.sale.sale_total_amt
> into outfile 'test123.csv'
> FIELDS terminated by ','
> FROM db.emp
> LEFT OUTER JOIN db.sale
> ON db.sale.emp_id = db.emp.emp_id;
>
> The query without exporting the file works fine, in about 12 sec/77 sec.  I
> read online how to export MySQL queries into csv's, and I'm not sure what I
> am doing wrong.  I keep getting the error:
> Error Code: 2013.  Lost connection to MySQL server during query, where the
> duration/fetch values are 600.547 sec (~10 minutes).
>
> I'm wondering:
> a) What is going on?
> b) How do I fix it?
>
> Thanks so much!!
>



-- 

[image: Inline image 2] <http://www.via.com/>

*Dhaval* | Database & System

*E:* dhaval.jaiswal@stripped <ramya@stripped>| *T:* 080 4043 3000 | *M:* +91
- 8095 397 843

[image: all-icon.jpg] <http://www.via.com/>

Attachment: [text/html]
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