>>>>> "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.
>>> read online how to export MySQL queries into csv's, and I'm not sure what
>>> 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
What MySQL version are you using
Creator of MySQL and MariaDB