List:General Discussion« Previous MessageNext Message »
From:Fred G Date:August 1 2012 5:24pm
Subject:Re: Exporting to CSV. Error Code: 2013. Lost connection to MySQL
server during query
View as plain text  
Hi Monty,

First of all, thanks so much for responding to my question! I am using
MySQLworkbench 5.2.37CE.  I'm pretty sure the issue has to do with
something on the administrator side of things. We managed to get it so that
I can click the icon to export the file, but he's still working on getting
it so that we can write an sql query to do this. So for all practical
purposes on my end, the question is being resolved.

But I don't understand how clicking the icon after running a select query
works for exporting, but the command to "outfile" in a sql query would not
work.

Thanks again

On Tue, Jul 31, 2012 at 5:36 AM, Michael Widenius <monty@stripped>wrote:

>
> Hi!
>
> >>>>> "Fred" == Fred G <Fred> writes:
>
> Fred> Thanks Dhaval.  Putting the join condition before INTO outfile
> doesn't seem
> Fred> to work, either.
>
> Fred> When I try to use the same outfile name 'test123.csv' I get Error
> Code:
> Fred> 1086 File 'test123.csv' already exists.  But then when I try to find
> the
> Fred> csv file on my computer, there is a folder with that name, but weird
> files
> Fred> in it, none of which are a csv-- and certainly not in the location
> that I
> Fred> thought it would be (the same directory that the .sql query is in).
>
> It's the mysqld server that is writing the .csv file. This means that
> the path is related to the mysql data directory and not to where your
> .sql file is.
>
> When using select into outfile it's always best to give a full path!
>
>
> Fred>  Additionally, when I try to identify a different path, such as
> 'C:\\' etc,
> Fred> I get an error.  This error is: Error Code: 1. Can't create/write to
> file
> Fred> "C:\test123.csv"(Errocde: 2).
>
> This probably means that you don't have write access to C:\
>
>
> Fred> I tried running the query outputting to a different named .csv file,
> but it
> Fred> is still just "running..." and seems like it was like yesterday
> where after
> Fred> 10 minutes I will get the Error that the MySQL connection was lost.
>
> The reason that your connection is lost are ether:
> - There is timeout in the client you are using
>   (The server never gives a timeout for running queries).
> - The mysqld server died (not likely but possible).
> - Some process in your system is killing quries that runs too long.
>
> One way to quickly check that things are working are by adding LIMIT 1
> to the query.
>
> Fred> Does anyone have an idea of what is going on?
>
> >>> 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).
>
> What is the exact error message?
> Which client are you using to do the query?
>
> It's strange that the query works fine when you are not using select
> into outfile.
>
> What MySQL version are you using
>
> Regards,
> Monty
> Creator of MySQL and MariaDB
>

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