From: Fred G Date: July 26 2012 1:46pm Subject: Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQL server during query List-Archive: http://lists.mysql.com/mysql/227896 Message-Id: MIME-Version: 1.0 Content-Type: multipart/related; boundary=047d7b2e48c434181d04c5bbd4fc --047d7b2e48c434181d04c5bbd4fc Content-Type: multipart/alternative; boundary=047d7b2e48c434181b04c5bbd4fb --047d7b2e48c434181b04c5bbd4fb Content-Type: text/plain; charset=ISO-8859-1 Thanks Dhaval. Putting the join condition before INTO outfile doesn't seem to work, either. When I try to use the same outfile name 'test123.csv' I get Error Code: 1086 File 'test123.csv' already exists. But then when I try to find the csv file on my computer, there is a folder with that name, but weird files in it, none of which are a csv-- and certainly not in the location that I thought it would be (the same directory that the .sql query is in). Additionally, when I try to identify a different path, such as 'C:\\' etc, I get an error. This error is: Error Code: 1. Can't create/write to file "C:\test123.csv"(Errocde: 2). I tried running the query outputting to a different named .csv file, but it is still just "running..." and seems like it was like yesterday where after 10 minutes I will get the Error that the MySQL connection was lost. Does anyone have an idea of what is going on? On Wed, Jul 25, 2012 at 9:22 PM, Dhaval Jaiswal wrote: > 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 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] > > *Dhaval* | Database & System > > *E:* dhaval.jaiswal@stripped | *T:* 080 4043 3000 | *M:* +91 > - 8095 397 843 > > [image: all-icon.jpg] > > --047d7b2e48c434181b04c5bbd4fb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks Dhaval. =A0Putting the join condition before INTO outfile doesn'= t seem to work, either.

When I try to use the same outfi= le name 'test123.csv' I get Error Code: 1086 File 'test123.csv&= #39; already exists. =A0But then when I try to find the csv file on my comp= uter, there is a folder with that name, but weird files in it, none of whic= h are a csv-- and certainly not in the location that I thought it would be = (the same directory that the .sql query is in). =A0Additionally, when I try= to identify a different path, such as 'C:\\' etc, I get an error. = =A0This error is: Error Code: 1. Can't create/write to file "C:\te= st123.csv"(Errocde: 2).

I tried running the query outputting to a different nam= ed .csv file, but it is still just "running..." and seems like it= was like yesterday where after 10 minutes I will get the Error that the My= SQL connection was lost.

Does anyone have an idea of what is going on?

On Wed, Jul 25, 2012 at 9:22 PM, Dhaval Jaiswal <dhaval.jaiswal@stripped> wrote:
SELECT * FROM test INTO OUTFILE '/home/t= est.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 =3D db.emp.emp_id;

The query without exporting the file works fine, in about 12 sec/77 sec. = =A0I
read online how to export MySQL queries into csv's, and I'm not sur= e what I
am doing wrong. =A0I keep getting the error:
Error Code: 2013. =A0Lost connection to MySQL server during query, where th= e
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!!



--

<= /p>

Dhaval | Database & System

E: dhaval.j= aiswal@via.com| T: 080 4043 3000 | M: +91 - 8095 397 843

3D"all-icon.jpg"



--047d7b2e48c434181b04c5bbd4fb-- --047d7b2e48c434181d04c5bbd4fc--