• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 95
  • Last Modified:

Select * into OUTFILE

I ma connected to the MySQL Server by a trusted connection on  a remote PC using work bench

I am using the Select *  into OUTFILE statement

Select * 
into OUTFILE 'C:\\testexport1.xls'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
  LINES TERMINATED BY '\n'
from tblmemberdraw_recipients;

Open in new window


This is working but is exporting the file to the server instead of my PC, how do I get the file to be exported to my PC instead of the server.
0
Brogrim
Asked:
Brogrim
  • 2
  • 2
1 Solution
 
Tomas Helgi JohannssonCommented:
Hi!

Select * ... INTO OUTFILE  ...
can only output to a file on the server itself.
You will need to use something like
mysql ... -e "SELECT * FROM ... " > myoutputfile

Regards,
     Tomas Helgi
0
 
BrogrimInformation Systems Development ManagerAuthor Commented:
Tomas

Does the -e mean echo in a command prompt?

I use workbench for all operations, does the above mean using the command prompt?

Thanks
0
 
Tomas Helgi JohannssonCommented:
Hi!

This was a command prompt example where -e stands for excecute and following is your query in "" brackets.
If you use MYSQL workbench you can execute your sql in a query tab where the
result is shown in a Result-tab which you then can export into file of your choice.


Regards,
    Tomas Helgi
0
 
BrogrimInformation Systems Development ManagerAuthor Commented:
OK, was hoping to be automate the complete procedure within Workbench but as you explained not possible without command prompt.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now